note 86018 modified in function.substr by danbrown

From: Date: Mon, 29 Sep 2008 17:06:46 +0000
Subject: note 86018 modified in function.substr by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-144882@lists.php.net to get a copy of this message
Simple use of substr to determine possession: <?php function possessive ($word) { return $word.(substr($word, -1) == 's' ? "'" : "'s"); } // Davis => Davis' // Paul => Paul's ?> --was-- Simple use of substr to determine possession: function possessive ($word) { return $word.(substr($word, -1) == 's' ? "'" : "'s"); } // Davis => Davis' // Paul => Paul's http://php.net/manual/en/function.substr.php

« previous php.notes (#144882) next »