De-Pluralize A String

Description: A snippet that will take a given string and if it is plural, the ‘s’ will be removed from the string.

<?PHP
 
IF($string{STRLEN($string)-1} == 's'){
    $string = SUBSTR($string, 0, -1);
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.