fork download
  1. <?php
  2. $str = "intKey=6, floatKey=12.34, simpleString=simple_value, booleanValue=true,
  3. quotedString=\"te=s=t= =l=ue\", singlQuoted='singleQuotedvalue', nullValue=null";
  4.  
  5. $result = explode(',', $str);
  6. $result2 = [];
  7. foreach ($result as $key) {
  8. $expl = explode('=', $key);
  9. $result2[trim($expl[0])] = trim($expl[1]);
  10. };
  11.  
  12. print_r($result2);
  13. ?>
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [intKey] => 6
    [floatKey] => 12.34
    [simpleString] => simple_value
    [booleanValue] => true
    [quotedString] => "te
    [singlQuoted] => 'singleQuotedvalue'
    [nullValue] => null
)