3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class BinarySearch { /** * @param mixed[] $items */ public function __invoke(array $items): int { for ($start = 0, $end = count($items); $i = $start + (int) (($end - $start) / 2), $i < $end; ) { // do something here break; } return $i; } } $binarySearch = new BinarySearch(); var_dump($binarySearch([])); var_dump($binarySearch([0, 1, 2, 3])); var_dump($binarySearch([0, 1, 2, 3, 4, 5, 6])); var_dump($binarySearch([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]));
Output for git.master, git.master_jit, rfc.property-hooks
int(0) int(2) int(3) int(5)

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:
170.15 ms | 477 KiB | 5 Q