Created
March 26, 2015 17:14
-
-
Save bytefade/2423529579e07f7013c7 to your computer and use it in GitHub Desktop.
Retornar parte da string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php function lmWord($string, $words = '100'){ | |
$count = strlen($string); | |
if($count <= $words){ | |
return $string; | |
}else{ | |
$strpos = strrpos(substr($string,0,$words),' '); | |
return substr($string,0,$strpos).'...'; | |
} | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment