I did the pre-requisite searches from the SEARCH function here on the forums and found nothing. What I am asking is most likely easy, but is something I have never tried before. So...
Ok...
I have a string.
Code: Select all
<?php
$test = "id=2 border=0 width=1 style=color:red;width:100px class=patience insanity peace name=TryMe";
?>What I want to do is pull this string apart... For instance...
In $test? I would like create an array that looks like this:
Array
{
[id] => "2",
[border] => "0",
[width] => "1",
[style] => "color:red;width:100px",
[class] => "patience insanity peace",
[name] => "TryMe"
}
I can get ALL of the above EXCEPT the class one...
I just:
Code: Select all
<?php
$newArray = explode( " ", $test );
?>I am thinking I will need a regular expression that searches out a single word before an equals sign... up to the next word in front of an equals sign. Where do I start...? Has anyone done this already? Help if you can...
Thanks...