3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = ['12345', 'L12345', 'L1S1', 'LS1', 'L123S45', 'L1x23S4yZY5', 'L1x!23S4y5']; foreach($strings as $string) { $hasMatches = preg_match_all('/^L([0-9a-zA-Z]+)S([0-9a-zA-Z]+)/m', $string, $matches, PREG_SET_ORDER, 0); if(filter_var($hasMatches, FILTER_VALIDATE_BOOLEAN)) { // converts $hasMatches to boolean echo 'THERE IS A MATCH: "' . $matches[0][0] . '"' . "\n"; echo '1st part: ' . $matches[0][1] . "\n"; echo '2nd part: ' . $matches[0][2] . "\n\n"; } }
Output for git.master, git.master_jit, rfc.property-hooks
THERE IS A MATCH: "L1S1" 1st part: 1 2nd part: 1 THERE IS A MATCH: "L123S45" 1st part: 123 2nd part: 45 THERE IS A MATCH: "L1x23S4yZY5" 1st part: 1x23 2nd part: 4yZY5

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