Last active
May 13, 2018 13:38
-
-
Save mdjwel/668d65d40749d7a6a6eda2393bb82f7f to your computer and use it in GitHub Desktop.
Limit latter (character) length function
This file contains 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 | |
// Limit latter | |
function prefix_limit_latter($string, $limit_length) { | |
if (strlen($string) > $limit_length) { | |
echo substr($string, 0, $limit_length) . '...'; | |
} | |
else { | |
echo $string; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment