note 86018 deleted from function.substr by cmb
| From: | cmb@php.net | Date: | Sun, 27 Oct 2019 09:04:51 +0000 |
| Subject: | note 86018 deleted from function.substr by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212819@lists.php.net to get a copy of this message | ||
Note Submitter: mr.davin
----
Simple use of substr to determine possession:
<?php
function possessive ($word) {
return $word.(substr($word, -1) == 's' ? "'" : "'s");
}
// Davis => Davis'
// Paul => Paul's
?>