3v4l.org

run code in 300+ PHP versions simultaneously
<?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.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
data[4] before:string(1) "e" data[4] after :string(1) "e" result:c,e
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.3.11, 4.4.0 - 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

preferences:
211.49 ms | 403 KiB | 327 Q