3v4l.org

run code in 500+ PHP versions simultaneously
<?php preg_match('/(a)(b)?(c)?/', 'a', $matches); var_dump($matches); preg_match('/(a)(b)?(c)?/', 'a', $matches, PREG_UNMATCHED_AS_NULL); var_dump($matches);
Output for 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
array(2) { [0]=> string(1) "a" [1]=> string(1) "a" } array(4) { [0]=> string(1) "a" [1]=> string(1) "a" [2]=> NULL [3]=> NULL }

preferences:
28.31 ms | 1152 KiB | 7 Q