note 65253 deleted from function.strpos by danbrown

From: Date: Sun, 17 May 2009 16:35:38 +0000
Subject: note 65253 deleted from function.strpos by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154856@lists.php.net to get a copy of this message
Note Submitter: ludvig dot ericson at gmail dot com ---- As a simplified way of doing what the poster below did: <?php $firstName .= '\''; if (!preg_match('/[sx]$/', $firstName)) { $firstName .= 's'; } ?> If you feel using a regular expression is too much, try it - I've not tested yet, but I'd say preg_match() is faster then two strpos() calls.

« previous php.notes (#154856) next »