3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $fp = fopen('php://memory', 'r+'); fputs($fp, 'a,b,c,d,"e",f,g,h'); fseek($fp, 0, SEEK_SET); $data = fgetcsv($fp); fclose($fp); unset($data[0],$data[1],$data[3],$data[5],$data[6],$data[7],$data[8]); echo "data[4] before:"; var_dump($data[4]); $data[4] = str_replace('"', ' ', $data[4]); echo "data[4] after :"; var_dump($data[4]); $fp = fopen('php://memory', 'r+'); fputcsv($fp, $data); fseek($fp, 0, SEEK_SET); echo "result:"; fpassthru($fp);
Output for 5.1.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
data[4] before:string(1) "e" data[4] after :string(1) "e" result:c,e
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.1.0 - 5.1.3
Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 3 Warning: fputs(): supplied argument is not a valid stream resource in /in/j3Icg on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/j3Icg on line 6 Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /in/j3Icg on line 8 Warning: fclose(): supplied argument is not a valid stream resource in /in/j3Icg on line 9 data[4] before:NULL data[4] after :string(0) "" Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 22 Warning: fputcsv() expects parameter 1 to be resource, boolean given in /in/j3Icg on line 23 Warning: fseek(): supplied argument is not a valid stream resource in /in/j3Icg on line 24 result: Warning: fpassthru(): supplied argument is not a valid stream resource in /in/j3Icg on line 27
Output for 5.0.0 - 5.0.5
Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 3 Warning: fputs(): supplied argument is not a valid stream resource in /in/j3Icg on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/j3Icg on line 6 Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /in/j3Icg on line 8 Warning: fclose(): supplied argument is not a valid stream resource in /in/j3Icg on line 9 data[4] before:NULL data[4] after :string(0) "" Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 22 Fatal error: Call to undefined function fputcsv() in /in/j3Icg on line 23
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 3 Warning: fputs(): supplied argument is not a valid stream resource in /in/j3Icg on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/j3Icg on line 6 Warning: Wrong parameter count for fgetcsv() in /in/j3Icg on line 8 Warning: fclose(): supplied argument is not a valid stream resource in /in/j3Icg on line 9 data[4] before:NULL data[4] after :string(0) "" Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 22 Fatal error: Call to undefined function: fputcsv() in /in/j3Icg on line 23
Process exited with code 255.
Output for 4.3.3 - 4.4.4
Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 3 Warning: fputs(): supplied argument is not a valid stream resource in /in/j3Icg on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/j3Icg on line 6 Warning: Wrong parameter count for fgetcsv() in /in/j3Icg on line 8 Warning: fclose(): supplied argument is not a valid stream resource in /in/j3Icg on line 9 data[4] before:NULL data[4] after :string(0) "" Warning: fopen(php://memory): failed to open stream: Success in /in/j3Icg on line 22 Fatal error: Call to undefined function: fputcsv() in /in/j3Icg on line 23
Process exited with code 255.
Output for 4.3.2
Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/j3Icg on line 3 Warning: fputs(): supplied argument is not a valid stream resource in /in/j3Icg on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/j3Icg on line 6 Warning: Wrong parameter count for fgetcsv() in /in/j3Icg on line 8 Warning: fclose(): supplied argument is not a valid stream resource in /in/j3Icg on line 9 data[4] before:NULL data[4] after :string(0) "" Warning: fopen(php://memory): failed to open stream: Inappropriate ioctl for device in /in/j3Icg on line 22 Fatal error: Call to undefined function: fputcsv() in /in/j3Icg on line 23
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: fopen(php://memory) [http://www.php.net/function.fopen]: failed to create stream: Inappropriate ioctl for device in /in/j3Icg on line 3 Warning: fputs(): supplied argument is not a valid stream resource in /in/j3Icg on line 5 Warning: fseek(): supplied argument is not a valid stream resource in /in/j3Icg on line 6 Warning: Wrong parameter count for fgetcsv() in /in/j3Icg on line 8 Warning: fclose(): supplied argument is not a valid stream resource in /in/j3Icg on line 9 data[4] before:NULL data[4] after :string(0) "" Warning: fopen(php://memory) [http://www.php.net/function.fopen]: failed to create stream: Inappropriate ioctl for device in /in/j3Icg on line 22 Fatal error: Call to undefined function: fputcsv() in /in/j3Icg on line 23