3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array(1, 2, 'd', "1,3"); $file = new splfileobject('/tmp/array.txt', 'w+'); $file->fputcsv($a); var_dump(file_get_contents('/tmp/array.txt')); $a = new arrayObject(array(1, 2, 'd', "1,3")); $file = new splfileobject('/tmp/arrayObject.txt', 'w+'); $file->fputcsv($a); var_dump(file_get_contents('/tmp/arrayObject.txt'));
based on SfAdO
Output for 5.4.0 - 7.2.0
string(12) "1,2,d,"1,3" " Warning: SplFileObject::fputcsv() expects parameter 1 to be array, object given in /in/ujtqc on line 12 string(0) ""
Output for 5.1.0 - 5.3.29
Fatal error: Call to undefined method SplFileObject::fputcsv() in /in/ujtqc on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Class 'splfileobject' not found in /in/ujtqc on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: splfileobject in /in/ujtqc on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: splfileobject in /in/ujtqc on line 4