3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (PHP_VERSION !== '7.1.6') die('Meh'); function kv(& $a) { $b = $a; end($b); $kv = [$k = key($b), current($b)]; // unset($b); // TRICKY: We must unset $b before modifying $a to avoid copy-on-write for $a. unset($a[$k]); return $kv; } $a = range(1, 2000000); next($a); next($a); echo current($a) . PHP_EOL; var_dump($a); var_dump(kv($a)); echo current($a) . PHP_EOL; var_dump($a);
Output for git.master, git.master_jit, rfc.property-hooks
Meh

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:
64.42 ms | 401 KiB | 8 Q