3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = ["date: march 27, 2017", "start: 12:30pm"]; foreach ($strings as $i => $string) { for ($i = 0; $i < 6; ++$i) { printf( "%d: %s BECOMES %s\n", $i, match($i) { 0 => ($pos = strpos($string, ": ")) ? substr($string, $pos + 2) : $string, 1 => ($sub = strstr($string, ": ")) ? substr($sub, 2) : $string, 2 => explode(': ', $string, 2)[1], 3 => array_slice(explode(': ', $string, 2), -1)[0], 4 => preg_replace('/(^.*?:\s)/', '', $string), 5 => preg_match("/^.*?:\s\K.*/", $string, $m) ? $m[0]: $string }, $string ); } }
Output for git.master, git.master_jit, rfc.property-hooks
0: march 27, 2017 BECOMES date: march 27, 2017 1: march 27, 2017 BECOMES date: march 27, 2017 2: march 27, 2017 BECOMES date: march 27, 2017 3: march 27, 2017 BECOMES date: march 27, 2017 4: march 27, 2017 BECOMES date: march 27, 2017 5: march 27, 2017 BECOMES date: march 27, 2017 0: 12:30pm BECOMES start: 12:30pm 1: 12:30pm BECOMES start: 12:30pm 2: 12:30pm BECOMES start: 12:30pm 3: 12:30pm BECOMES start: 12:30pm 4: 12:30pm BECOMES start: 12:30pm 5: 12:30pm BECOMES start: 12:30pm

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:
29.46 ms | 406 KiB | 5 Q