3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function replace_callback($matches){ return $matches[1]; } $str = "abc{123}def{456}ghi{789}jkl"; $result = preg_replace_callback('/\{.*?\}/', 'replace_callback', $str); print_r($result);
Output for 5.3.0 - 7.1.0
Notice: Undefined offset: 1 in /in/mmH8m on line 5 Notice: Undefined offset: 1 in /in/mmH8m on line 5 Notice: Undefined offset: 1 in /in/mmH8m on line 5 abcdefghijkl
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 1 in /in/mmH8m on line 5 Notice: Undefined offset: 1 in /in/mmH8m on line 5 Notice: Undefined offset: 1 in /in/mmH8m on line 5 abcdefghijkl