fork download
  1. <?php
  2. $string = 'quotedStr="Hello,world"';
  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 #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
array(2) {
  ["quotedStr"]=>
  string(6) ""Hello"
  ["world""]=>
  NULL
}
stderr
PHP Notice:  Undefined offset: 1 in /home/Sw6eW1/prog.php on line 6
PHP Notice:  Undefined offset: 1 in /home/Sw6eW1/prog.php on line 9
PHP Notice:  Undefined offset: 1 in /home/Sw6eW1/prog.php on line 12
PHP Notice:  Undefined offset: 1 in /home/Sw6eW1/prog.php on line 15