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); echo $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/gVFuQ on line 3 Warning: A non-numeric value encountered in /in/gVFuQ on line 3 Warning: A non-numeric value encountered in /in/gVFuQ on line 3 Notice: Array to string conversion in /in/gVFuQ on line 5 Array Warning: A non-numeric value encountered in /in/gVFuQ on line 6 Warning: A non-numeric value encountered in /in/gVFuQ on line 6 Notice: Undefined offset: 0 in /in/gVFuQ on line 6
Output for 5.4.0 - 7.0.14
Notice: Array to string conversion in /in/gVFuQ on line 5 Array Notice: Undefined offset: 0 in /in/gVFuQ on line 6
Output for 5.3.0 - 5.3.29
Array Notice: Undefined offset: 0 in /in/gVFuQ on line 6
Output for 5.0.0 - 5.2.17
Array Notice: Undefined offset: 0 in /in/gVFuQ on line 6
Output for 4.3.2 - 4.4.9
Array Notice: Undefined offset: 0 in /in/gVFuQ on line 6 Notice: Undefined variable: r in /in/gVFuQ on line 6 Warning: Wrong parameter count for str_replace() in /in/gVFuQ on line 6 Notice: Undefined variable: r in /in/gVFuQ on line 7
Output for 4.3.0 - 4.3.1
Array Notice: Undefined offset: 0 in /in/gVFuQ on line 6 Notice: Undefined variable: r in /in/gVFuQ on line 6 Notice: Undefined variable: r in /in/gVFuQ on line 7