3v4l.org

run code in 200+ 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 7.3.0rc3 - 7.3.0rc4
Warning: file_put_contents(): open_basedir restriction in effect. File(test.csv) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Jhpkh on line 8 Warning: file_put_contents(test.csv): failed to open stream: Operation not permitted in /in/Jhpkh on line 8 Warning: fopen(): open_basedir restriction in effect. File(test.csv) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Jhpkh on line 9 Warning: fopen(test.csv): failed to open stream: Operation not permitted in /in/Jhpkh on line 9 Warning: fgetcsv() expects parameter 1 to be resource, bool given in /in/Jhpkh on line 10 Warning: unlink(): open_basedir restriction in effect. File(test.csv) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Jhpkh on line 16
Output for 7.3.0alpha1 - 7.3.0beta1
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, bool given in /in/Jhpkh on line 10 Warning: unlink(test.csv): No such file or directory in /in/Jhpkh on line 16
Output for 7.1.20, 7.2.6
Warning: file_put_contents(): open_basedir restriction in effect. File(test.csv) is not within the allowed path(s): (/tmp:/in) in /in/Jhpkh on line 8 Warning: file_put_contents(test.csv): failed to open stream: Operation not permitted in /in/Jhpkh on line 8 Warning: fopen(): open_basedir restriction in effect. File(test.csv) is not within the allowed path(s): (/tmp:/in) in /in/Jhpkh on line 9 Warning: fopen(test.csv): failed to open stream: Operation not permitted in /in/Jhpkh on line 9 Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /in/Jhpkh on line 10 Warning: unlink(): open_basedir restriction in effect. File(test.csv) is not within the allowed path(s): (/tmp:/in) in /in/Jhpkh on line 16
Output for 5.2.3 - 7.1.10, 7.2.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 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