3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function shortText($string,$lenght) { if(strlen($string) > $lenght) { $string = substr($string,0,$lenght)."-"; $string_ende = strrchr($string, " "); $string = str_replace($string_ende," -", $string); } return $string; } echo shortText("sfrguhdfghdurghdufghdufghudfghudfghudfghudfgh", 10);
Output for 4.3.0 - 5.3.20, 5.3.22 - 5.4.45, 5.5.1 - 7.2.0
sfrguhdfgh-
Output for 5.3.21, 5.5.0

Process exited with code 137.