3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $s = "ab"; $s1 = "cAbfabe"; $out = $s1; do { $out = stristr($out,$s); echo "out: $out\n"; $s3 = substr($out,0,count($s)+1); $s1 = str_replace($s3,"<$s3>",$s1); echo "s3: $s3\n"; $out = substr($out,count($s)+1); echo "out: $out\n"; echo "=======\n"; } while ($out != false); echo "s1: $s1\n";
Output for 7.2.0 - 7.3.0rc4
out: Abfabe Warning: count(): Parameter must be an array or an object that implements Countable in /in/FeLAD on line 9 s3: Ab Warning: count(): Parameter must be an array or an object that implements Countable in /in/FeLAD on line 12 out: fabe ======= out: abe Warning: count(): Parameter must be an array or an object that implements Countable in /in/FeLAD on line 9 s3: ab Warning: count(): Parameter must be an array or an object that implements Countable in /in/FeLAD on line 12 out: e ======= out: Warning: count(): Parameter must be an array or an object that implements Countable in /in/FeLAD on line 9 s3: Warning: count(): Parameter must be an array or an object that implements Countable in /in/FeLAD on line 12 out: ======= s1: c<Ab>f<ab>e
Output for 4.3.0 - 7.1.20
out: Abfabe s3: Ab out: fabe ======= out: abe s3: ab out: e ======= out: s3: out: ======= s1: c<Ab>f<ab>e