3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ "k0"=>"v0", "k1"=>"v1", "k2"=>"v2", "k3"=>"v3", "k4"=>"v4", ]; $result_1 = []; while (key($data)) { $result_1[key($data)] = current($data); next($data); } print_r($result_1); //Then perform the same operation in a function supplying the same array $data as argument //(mind that the internal pointer of $data is at the end): traverse($data); function traverse($arr){ $result_2 = []; while (key($arr)) { $result_2[key($arr)] = current($arr); next($arr); } print_r($result_2); }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [k0] => v0 [k1] => v1 [k2] => v2 [k3] => v3 [k4] => v4 ) Array ( )

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