3v4l.org

run code in 300+ PHP versions simultaneously
<?php function csv_reverse($handle, ...$csv_options) { $offsets = []; do { $offsets[] = ftell($handle); } while($row = fgetcsv($handle, ...$csv_options)); array_pop($offsets); // last offset is EOF for( $i=count($offsets)-1; $i>=0; --$i ) { fseek($handle, $offsets[$i]); yield fgetcsv($handle, ...$csv_options); } } $csv = <<<_E_ id,name,value 1,foo,"hello world" 2,bar,"hello world" 3, baz,"""hello world""" _E_; $in = fopen('php://memory', 'rwb'); fwrite($in, $csv); rewind($in); fgets($in); foreach( csv_reverse($in, null, ',', '"', '\\') as $row ) { var_dump($row); }
Output for git.master
/bin/php-git-master: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-git-master) /bin/php-git-master: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-git-master)
Process exited with code 1.
Output for git.master_jit, rfc.property-hooks
array(3) { [0]=> string(1) "3" [1]=> string(4) " baz" [2]=> string(14) ""hello world"" } array(3) { [0]=> string(1) "2" [1]=> string(3) "bar" [2]=> string(12) "hello world" } array(3) { [0]=> string(1) "1" [1]=> string(3) "foo" [2]=> string(11) "hello world" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
31.34 ms | 407 KiB | 5 Q