3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $text = "This is a #hastag within some #awesometext."; function tagIt($body) { $string = $body; $htag = "#"; $arr = preg_split("/(\s|\.|\!/)", $string);print_r($arr); $arrc = count($arr); $i = 0; while($i < $arrc) { if(substr($arr[$i], 0, 1) === $htag) { $arr[$i] = "<a href = 'category.php?tag=$arr[$i]'>".$arr[$i]."</a>"; } $i++; } $string = implode(" ", $arr); echo "\n".$string."\n"; } tagIt($text);
Output for 7.2.0 - 7.3.0alpha1
Warning: preg_split(): Unknown modifier ')' in /in/PcoN1 on line 9 Warning: count(): Parameter must be an array or an object that implements Countable in /in/PcoN1 on line 10 Warning: implode(): Invalid arguments passed in /in/PcoN1 on line 20
Output for 5.2.5 - 7.1.10
Warning: preg_split(): Unknown modifier ')' in /in/PcoN1 on line 9 Warning: implode(): Invalid arguments passed in /in/PcoN1 on line 20
Output for 4.3.11 - 5.2.4
Warning: preg_split(): Unknown modifier ')' in /in/PcoN1 on line 9 Warning: implode(): Bad arguments. in /in/PcoN1 on line 20
Output for 4.3.2 - 4.3.10
Warning: Unknown modifier ')' in /in/PcoN1 on line 9 Warning: implode(): Bad arguments. in /in/PcoN1 on line 20
Output for 4.3.0 - 4.3.1
Warning: Unknown modifier ')' in /in/PcoN1 on line 9 Warning: implode() [http://www.php.net/function.implode]: Bad arguments. in /in/PcoN1 on line 20