3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $s = "ab"; $s1 = "cAbfabe"; $s2 = $s1; do { $s2 = stristr($s2,$s); echo "s2: $s2\n"; $s3 = substr($s2,0,count($s)+1); $s1 = str_ireplace($s3,"<$s3>",$s1); echo "s3: $s3\n"; $s2 = substr($s2,count($s)+1); echo "s2: $s2\n"; echo "=======\n"; } while ($s2 != false); echo "s1: $s1\n";
Output for 7.2.0 - 7.3.0rc4
s2: Abfabe Warning: count(): Parameter must be an array or an object that implements Countable in /in/vtKpL on line 9 s3: Ab Warning: count(): Parameter must be an array or an object that implements Countable in /in/vtKpL on line 12 s2: fabe ======= s2: abe Warning: count(): Parameter must be an array or an object that implements Countable in /in/vtKpL on line 9 s3: ab Warning: count(): Parameter must be an array or an object that implements Countable in /in/vtKpL on line 12 s2: e ======= s2: Warning: count(): Parameter must be an array or an object that implements Countable in /in/vtKpL on line 9 s3: Warning: count(): Parameter must be an array or an object that implements Countable in /in/vtKpL on line 12 s2: ======= s1: c<<ab>>f<<ab>>e
Output for 5.0.0 - 7.1.20
s2: Abfabe s3: Ab s2: fabe ======= s2: abe s3: ab s2: e ======= s2: s3: s2: ======= s1: c<<ab>>f<<ab>>e
Output for 4.4.5 - 4.4.9
s2: Abfabe Fatal error: Call to undefined function: str_ireplace() in /in/vtKpL on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.4
s2: Abfabe Fatal error: Call to undefined function: str_ireplace() in /in/vtKpL on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
s2: Abfabe Fatal error: Call to undefined function: str_ireplace() in /in/vtKpL on line 10