3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $source = '"parent name","child name","title" "parentA","childA","titleA" '; $file = new SplTempFileObject(); $file->fwrite($source); echo "BASIC FLAG:", PHP_EOL; $file->setFlags(SplFileObject::READ_CSV); var_dump(count(iterator_to_array($file))); echo "SKIP EMPTY FLAG:", PHP_EOL; $file->setFlags(SplFileObject::READ_CSV|SplFileObject::READ_AHEAD|SplFileObject::SKIP_EMPTY); var_dump(count(iterator_to_array($file))); echo "DROP NEW LINE FLAG:", PHP_EOL; $file->setFlags(SplFileObject::READ_CSV|SplFileObject::DROP_NEW_LINE); var_dump(count(iterator_to_array($file)));
Output for 5.5.24 - 7.1.20
BASIC FLAG: int(3) SKIP EMPTY FLAG: int(2) DROP NEW LINE FLAG: int(3)
Output for 5.2.0 - 5.4.45
BASIC FLAG: int(2) SKIP EMPTY FLAG: int(2) DROP NEW LINE FLAG: int(2)
Output for 5.1.4 - 5.1.6
BASIC FLAG: Fatal error: Undefined class constant 'READ_CSV' in /in/kn7l0 on line 10
Process exited with code 255.
Output for 5.1.2 - 5.1.3
Fatal error: Uncaught exception 'RuntimeException' with message 'SplTempFileObject::__construct(php://temp): failed to open stream: Inappropriate ioctl for device' in /in/kn7l0:6 Stack trace: #0 /in/kn7l0(6): SplTempFileObject->__construct() #1 {main} thrown in /in/kn7l0 on line 6
Process exited with code 255.
Output for 5.0.0 - 5.1.1
Fatal error: Class 'SplTempFileObject' not found in /in/kn7l0 on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/kn7l0 on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '(' in /in/kn7l0 on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/kn7l0 on line 10
Process exited with code 255.