I have the following string:
key:surname +++ value:Tesla|||key:name +++ value:Nikola|||key:age +++ value:86|||
How with the PHP I can convert it into an associative array? Like:
echo $arr['surname'];
Tesla
I'm trying it, but can't write a correct expression:
$str= "key:surname +++ value:Tesla|||key:name +++ value:Nikola|||key:age +++ value:86|||";
preg_match_all("regex_here",$str,$out);
unset($out[0]);
$out = array_combine($out[1],$out[2]) ;
print_r($out);
Thanks.
json_encodeandjson_decode) as an easier, better designed system.serializeandunserializefunctions? See: nz.php.net/manual/en/function.serialize.php