3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $p = '~^\[((?:"\d+",?){0,3})~'; $a = '["1","2","3","4"]'; preg_match_all($p, $a, $r); var_dump($r);
based on XfrbY
Output for 5.6.0 - 7.3.0rc4
array(2) { [0]=> array(1) { [0]=> string(13) "["1","2","3"," } [1]=> array(1) { [0]=> string(12) ""1","2","3"," } }