3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fruits = array( "apple" => "yummy", "orange" => "ah ya, nice", "grape" => "wow, I love it!", "plum" => "nah, not me" ); $obj = new ArrayObject( $fruits ); $it = $obj->getIterator(); // How many items are we iterating over? echo "Iterating over: " . $obj->count() . " values\n"; // Iterate over the values in the ArrayObject: while( $it->valid() ) { echo $it->key() . "=" . $it->current() . "\n"; $it->next(); } // The good thing here is that it can be iterated with foreach loop foreach ($it as $key=>$val) echo $key.":".$val."\n"; /* Outputs something like */ /*Iterating over: 4 values apple=yummy orange=ah ya, nice grape=wow, I love it! plum=nah, not me*/ ?>
Output for git.master, git.master_jit, rfc.property-hooks
Iterating over: 4 values apple=yummy orange=ah ya, nice grape=wow, I love it! plum=nah, not me apple:yummy orange:ah ya, nice grape:wow, I love it! plum:nah, not me

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