3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = 'hello world, world!'; # 0123456 var_dump(preg_match('/\Gworld/', $string, $matches, PREG_OFFSET_CAPTURE, 6), $matches[0]); var_dump(preg_match('/\Gworld/', $string, $matches, PREG_OFFSET_CAPTURE, 3), $matches[0]);
based on NJoqL
Output for 5.3.0 - 7.2.0
int(1) array(2) { [0]=> string(5) "world" [1]=> int(6) } Notice: Undefined offset: 0 in /in/J6jMQ on line 7 int(0) NULL
Output for 4.3.3 - 5.2.17
int(1) array(2) { [0]=> string(5) "world" [1]=> int(6) } Notice: Undefined offset: 0 in /in/J6jMQ on line 7 int(0) NULL
Output for 4.3.0 - 4.3.2
Warning: Wrong parameter count for preg_match() in /in/J6jMQ on line 6 NULL NULL Warning: Wrong parameter count for preg_match() in /in/J6jMQ on line 7 NULL NULL