fork(1) download
  1. <?php
  2. $string = 'intKey=6, floatKey=12.34, simpleString=simple_value, booleanValue=true, quotedString="test\"value",singlQuoted=' . 'singlQuotedValue' . ',nullValue=null';
  3. $mess = explode(",", $string);
  4. for ($i = 0; $i < count($mess); $i++) {
  5. $mess1 = explode("=", $mess[$i]);
  6. if (is_float($mess1[1])) {
  7. $mess1[1] = (double) $mess1[1];
  8. }
  9. if (is_string($mess1[1])) {
  10. $mess1[1] = (string) $mess1[1];
  11. }
  12. if (is_numeric($mess1[1])) {
  13. $mess1[1] = (int) $mess1[1];
  14. }
  15. $k[$mess1[0]] = $mess1[1];
  16. }
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
array(7) {
  ["intKey"]=>
  int(6)
  [" floatKey"]=>
  int(12)
  [" simpleString"]=>
  string(12) "simple_value"
  [" booleanValue"]=>
  string(4) "true"
  [" quotedString"]=>
  string(13) ""test\"value""
  ["singlQuoted"]=>
  string(16) "singlQuotedValue"
  ["nullValue"]=>
  string(4) "null"
}