3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php setlocale(LC_ALL,'C'); $utfchar = chr(0xC3).chr(0x89); // U+009C in UTF-8 $csv = $utfchar."x".$utfchar."x\n"; file_put_contents('test.csv', $csv); $file = fopen('test.csv', 'r'); $data = fgetcsv($file); for ($i = 0; $i < strlen($data[0]); $i++) { echo dechex(ord($data[0][$i])).' '; } echo "\n"; unlink('test.csv'); // expected: c3 89 78 c3 89 78 - "ÉxÉx" // actual: 78 c3 89 78 - "xÉx"
Output for 5.2.3 - 5.6.28, 7.0.0 - 7.1.0
Warning: file_put_contents(test.csv): failed to open stream: Permission denied in /in/Jhpkh on line 8 Warning: fopen(test.csv): failed to open stream: No such file or directory in /in/Jhpkh on line 9 Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /in/Jhpkh on line 10 Warning: unlink(test.csv): No such file or directory in /in/Jhpkh on line 16
Output for hhvm-3.12.0
Warning: Permission denied in /in/Jhpkh on line 8 Warning: No such file or directory in /in/Jhpkh on line 9 Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /in/Jhpkh on line 10 Warning: unlink(test.csv): No such file or directory in /in/Jhpkh on line 16
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.2.2
Warning: file_put_contents(test.csv): failed to open stream: Read-only file system in /in/Jhpkh on line 8 Warning: fopen(test.csv): failed to open stream: No such file or directory in /in/Jhpkh on line 9 Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /in/Jhpkh on line 10 Warning: unlink(test.csv): Read-only file system in /in/Jhpkh on line 16
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/Jhpkh on line 19
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: file_put_contents() in /in/Jhpkh on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: file_put_contents() in /in/Jhpkh on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: file_put_contents() in /in/Jhpkh on line 8