3v4l.org

run code in 500+ PHP versions simultaneously
<?php $chars = ['A','B','C','F','a','b','c','d','e','f','h','i','j','k','l','o','q','!','?','0','2','3','4','9']; $result = []; $range = [null]; foreach ($chars as $char) { if ($range[0] === null) { $range = [$char]; } elseif (ord($range[1] ?? $range[0]) === ord($char) - 1) { $range[1] = $char; } else { $result[] = implode('-', $range); $range = [$char]; } } if ($range[0] !== null) { $result[] = implode('-', $range); } var_export($result);
Output for rfc.property-hooks, git.master, git.master_jit
array ( 0 => 'A-C', 1 => 'F', 2 => 'a-f', 3 => 'h-l', 4 => 'o', 5 => 'q', 6 => '!', 7 => '?', 8 => '0', 9 => '2-4', 10 => '9', )

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:
52.85 ms | 1277 KiB | 4 Q