Hi, Need a little help on Regular Expression and PHP. Here is my situation: I need to find a two part string similar to this in a page: [abcdefghij klmnopqrst] < There is a space between the words to separate. Now I want to divide it two strings $att1 = abcdefghij $att2 = klmnopqrst PHP: Now execute a PHP code similar to this; if ($att1 == 'A certain Word') { - Codes Here - } elseif ($att1 == 'Another Certain Word') { - Codes Here - } else { -Codes Here - } PHP: How can I do that?
To divide a string by space, you can use this code: $string = "abcdefghij klmnopqrst"; $splitted = preg_split("/ /", $string); $att1 = $splitted[0]; $att2 = $splitted[1]; echo $att1.'<br />'; echo $att2.'<br />'; PHP: