3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [1, 2, 3, 4, 4, 1, 2, 5, 5, 11, 11]; sort($arr); for($i = 0, $max = count($arr); $i < $max; $i++){ // is single number last element in array? if($i == count($arr)-1) $singleNum = $arr[$i]; // If adjacent elements the same, skip if($i < count($arr)-1 && $arr[$i] == $arr[$i+1]){ $i++; } else { // found single number. $singleNum = $arr[$i]; } } var_dump($singleNum);
Output for git.master, git.master_jit, rfc.property-hooks
int(3)

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