3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fp = fopen('php://output', 'w'); $input = ['some', 'random "stuff"', 'and \"shite\"', 'or \\\"more\\\"']; foreach ($input as &$field) { $field = preg_replace('~\\+"~', '"', $field); var_dump(preg_replace('~\\\\+"~', '"', $field)); } fputcsv($fp, $input); fclose($fp);
based on OiODe
Output for 5.4.0 - 7.2.0
string(4) "some" string(14) "random "stuff"" string(11) "and "shite"" string(9) "or "more"" some,"random ""stuff""","and \"shite\"","or \\"more\\""
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/DjUOf on line 4
Process exited with code 255.