repl.it
@anonymous/

MisguidedSarcasticPinniped

PHP (Legacy)

No description

fork
loading
main.php
1
2
3
4
5
6
7
8
9
10
11
function resumo($string, $chars=0){
   if(!mb_strlen($string)){
     return '';
   }
   return  $chars == 0 ? $string : substr($string, 0, $chars)  .'...';
}

echo resumo("bla bla bla bla bla", 4)."\n";
echo resumo("bla bla bla bla bla")."\n";
echo resumo("bl", 5);
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7