3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lines = [ 'Alice Sandy', 'Alice Nanami', 'James Watt', 'Alice Monica', 'Johann Gauss', 'Cooper Alice', ]; $needle = 'Alice'; foreach($lines as $index => &$line) { if ($needle === strstr($line, ' ', true)) { // check whole first word if (!isset($firstOccurrence)) { $firstOccurrence =& $line; } else { $firstOccurrence .= strstr($line, ' '); unset($lines[$index]); } } } var_export($lines);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'Alice Sandy Nanami Monica', 2 => 'James Watt', 4 => 'Johann Gauss', 5 => 'Cooper Alice', )

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