3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $tmp = tempnam('/tmp', 'php'); $fp = fopen($tmp, 'w+'); fwrite($fp, 'foo,bar,baz,bat'); rewind($fp); $line = fgetcsv($fp); var_dump($line); rewind($fp); $line = fgetcsv($fp, 10); var_dump($line);
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(4) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(3) "baz" [3]=> string(3) "bat" } array(3) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(2) "ba" }
Output for 4.3.0 - 4.4.9
Warning: Wrong parameter count for fgetcsv() in /in/RuLLt on line 8 NULL array(3) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(1) "b" }