3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'foo', 'bar', 'baz' ); srand(1); if (defined('MT_RAND_PHP')) mt_srand(1, MT_RAND_PHP); else mt_srand(1); function custom_array_rand() { global $array; $key = array_rand($array); var_dump('found key ' . $key); return $array[$key]; } var_dump( custom_array_rand(), custom_array_rand(), custom_array_rand() );
Output for git.master, git.master_jit
string(11) "found key 1" string(11) "found key 0" string(11) "found key 2" string(3) "bar" string(3) "foo" string(3) "baz"

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:
116.11 ms | 405 KiB | 5 Q