3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php preg_match_all('/(^[a-z0-9_]+)|::([a-z0-9_]+)/', 'lol::second::third::fourth', $matches, PREG_OFFSET_CAPTURE); var_dump($matches);
based on 8Ge0N
Output for 4.3.3 - 7.1.0
array(3) { [0]=> array(4) { [0]=> array(2) { [0]=> string(3) "lol" [1]=> int(0) } [1]=> array(2) { [0]=> string(8) "::second" [1]=> int(3) } [2]=> array(2) { [0]=> string(7) "::third" [1]=> int(11) } [3]=> array(2) { [0]=> string(8) "::fourth" [1]=> int(18) } } [1]=> array(4) { [0]=> array(2) { [0]=> string(3) "lol" [1]=> int(0) } [1]=> array(2) { [0]=> string(0) "" [1]=> int(-1) } [2]=> array(2) { [0]=> string(0) "" [1]=> int(-1) } [3]=> array(2) { [0]=> string(0) "" [1]=> int(-1) } } [2]=> array(4) { [0]=> string(0) "" [1]=> array(2) { [0]=> string(6) "second" [1]=> int(5) } [2]=> array(2) { [0]=> string(5) "third" [1]=> int(13) } [3]=> array(2) { [0]=> string(6) "fourth" [1]=> int(20) } } }
Output for 4.3.0 - 4.3.2
Warning: Wrong value for parameter 4 in call to preg_match_all() in /in/5R2eZ on line 4 NULL