fork(1) download
  1. <?php
  2.  
  3. $input = 'key=value,e4354ahj\,=awet3,asdfa\=asdfa=23f23';
  4. $keyValuePairs = preg_split('/(?<!\\\\),/', $input);
  5.  
  6. foreach ($keyValuePairs as $pair) {
  7. list($key, $value) = preg_split('/(?<!\\\\)=/', $pair);
  8. echo "$key => $value\n";
  9. }
  10.  
  11.  
  12.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
key => value
e4354ahj\, => awet3
asdfa\=asdfa => 23f23