3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function removeRepeatedCharacters($key){ $removeNext = false; for($i = 0; $i < strlen($key); $i++){ if($key[$i] == $key[$i+1]){ $key[$i] = ' '; $removeNext = true; } else if($removeNext){ $key[$i] =' '; $removeNext= false; } } echo str_replace(' ','',$key); } removeRepeatedCharacters('aabcccdee');
based on lZOtL
Output for 5.6.0 - 5.6.30, hhvm-3.18.4 - 3.21.0, 7.0.0 - 7.3.0rc3
Notice: Uninitialized string offset: 9 in /in/GLnJ2 on line 6 bd