3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string1 = "-val1(sec1)-"; $string2 = "-val2(sec2)-"; $string3 = "-val3(sec3)-"; $big_string = $string1 . $string2 . $string3; if (preg_match_all('/-([^(]+)\(([^)]+)\)-/', $big_string, $matches, PREG_SET_ORDER)) { $result = array_map(static fn($match) => array_slice($match, 1), $matches); print_r($result); }
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
Array ( [0] => Array ( [0] => val1 [1] => sec1 ) [1] => Array ( [0] => val2 [1] => sec2 ) [2] => Array ( [0] => val3 [1] => sec3 ) )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 7.3.0 - 7.3.33
Parse error: syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /in/2Etfk on line 9
Process exited with code 255.

preferences:
186.2 ms | 409 KiB | 5 Q