3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [0, false, null]; $flag = 0; $firstElement = $arr[0]; foreach($arr as $val){ // CHECK IF THE FIRST ELEMENT DIFFERS FROM ANY OTHER ELEMENT IN THE ARRAY if($firstElement != $val){ // FIRST MISMATCH FOUND. UPDATE FLAG VALUE AND BREAK OUT OF THE LOOP. $flag = 1; break; } } if($flag == 0){ echo 'ALL THE ELEMENTS ARE SAME'; }else{ echo 'ALL THE ELEMENTS ARE NOT SAME'; }
Output for git.master_jit, git.master, rfc.property-hooks
ALL THE ELEMENTS ARE SAME

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