3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result=<<<TXT 1 5 7 2 6 9 a c z TXT; $stat=array("odd"=>0,"even"=>0,"invalid"=>array()); foreach(explode("\n",$result) as $r) { $r=trim($r);// in case input is separated by \r\n if(!is_numeric($r)) { $stat["invalid"][]=$r; } elseif($r%2==0) { $stat["even"]+=intval($r); } else { $stat["odd"]+=intval($r); } } echo "Odd: ".$stat["odd"]."\n"; echo "Even: ".$stat["even"]."\n"; echo "Invalid: ".implode(" ",$stat["invalid"]);
Output for git.master, git.master_jit, rfc.property-hooks
Odd: 22 Even: 8 Invalid: a c z

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