3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'foo', 'foo', 'bar', 'baz', 'baz' ]; array_walk($arr, function (&$item, $k) use ($arr) { $lower = mb_strtolower($item, 'utf-8'); foreach ($arr as $i => $v) { var_dump($k .'='. $i); if ($i !== $k && $v !== null && $lower === mb_strtolower($v, 'utf-8')) { var_dump('rm'); $item = null; } } }); var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
string(3) "0=0" string(3) "0=1" string(2) "rm" string(3) "0=2" string(3) "0=3" string(3) "0=4" string(3) "1=0" string(2) "rm" string(3) "1=1" string(3) "1=2" string(3) "1=3" string(3) "1=4" string(3) "2=0" string(3) "2=1" string(3) "2=2" string(3) "2=3" string(3) "2=4" string(3) "3=0" string(3) "3=1" string(3) "3=2" string(3) "3=3" string(3) "3=4" string(2) "rm" string(3) "4=0" string(3) "4=1" string(3) "4=2" string(3) "4=3" string(2) "rm" string(3) "4=4" array(5) { [0]=> NULL [1]=> NULL [2]=> string(3) "bar" [3]=> NULL [4]=> NULL }

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:
48.44 ms | 402 KiB | 8 Q