fork(2) download
  1. <?php
  2.  
  3. $string = 'key1=>value1,key2=>value2,key3=>value3';
  4. $pairs = explode(',', $string);
  5. $data = array();
  6. foreach ($pairs as $pair) {
  7. list($key, $value) = explode('=>', $pair);
  8. $data[$key] = $value;
  9. }
  10. var_dump($data);
  11.  
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
array(3) {
  ["key1"]=>
  string(6) "value1"
  ["key2"]=>
  string(6) "value2"
  ["key3"]=>
  string(6) "value3"
}