3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = []; for ($i = 0; $i < 300; $i++) { $pattern[] = "(?'group{$i}'{$i}$)"; } $fullPattern = '/' . implode('|', $pattern) . '/uix'; preg_match($fullPattern, '150', $matches); var_dump(isset($matches['group253'])); var_dump(isset($matches['group254'])); var_dump(isset($matches['group255'])); var_dump($matches['group150']); var_dump($matches['group151']);
based on sJWmA
Output for 8.0.0 - 8.0.3
bool(false) bool(false) bool(false) string(3) "150" Warning: Undefined array key "group151" in /in/5CR74 on line 15 NULL
Output for 5.6.0 - 5.6.24, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.27, 7.4.0 - 7.4.16
bool(false) bool(false) bool(false) string(3) "150" Notice: Undefined index: group151 in /in/5CR74 on line 15 NULL