3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $n = "Chan"; $str = ")24.231.23.2 " + $n + ":"; preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} " . $n . "/", $str, $m); str_replace(" " + $n, "", $m[0], $r); $ip = $r[0]; // Should return 24.231.23.2 echo $ip;
Output for 7.1.0
Warning: A non-numeric value encountered in /in/omaHd on line 3 Warning: A non-numeric value encountered in /in/omaHd on line 3 Warning: A non-numeric value encountered in /in/omaHd on line 3 Warning: A non-numeric value encountered in /in/omaHd on line 5 Warning: A non-numeric value encountered in /in/omaHd on line 5 Notice: Undefined offset: 0 in /in/omaHd on line 5
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.0.14
Notice: Undefined offset: 0 in /in/omaHd on line 5
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: 0 in /in/omaHd on line 5
Output for 5.0.0 - 5.2.17
Notice: Undefined offset: 0 in /in/omaHd on line 5
Output for 4.3.2 - 4.4.9
Notice: Undefined offset: 0 in /in/omaHd on line 5 Notice: Undefined variable: r in /in/omaHd on line 5 Warning: Wrong parameter count for str_replace() in /in/omaHd on line 5 Notice: Undefined variable: r in /in/omaHd on line 6
Output for 4.3.0 - 4.3.1
Notice: Undefined offset: 0 in /in/omaHd on line 5 Notice: Undefined variable: r in /in/omaHd on line 5 Notice: Undefined variable: r in /in/omaHd on line 6