note 64604 added to function.strpos

From: Date: Wed, 19 Apr 2006 07:14:11 +0000
Subject: note 64604 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-108500@lists.php.net to get a copy of this message
If you want to check if a string ends with another string, then I think that you can use the fact that strpos() returns 0 for strings found at the beginning of other strings, and reverse both strings using strrev(). So for denying email for certain domains you might use if (strpos(strrev($email), strrev($deniedpattern)) === 0) { .... } This idea comes from Hans Lellelid's code at http://tinyurl.com/ftayb ---- Server IP: 210.138.109.182 Probable Submitter: 133.62.200.220 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.strpos.php Edit -- http://master.php.net/note/edit/64604 Del: integrated -- http://master.php.net/note/delete/64604/integrated Del: useless -- http://master.php.net/note/delete/64604/useless Del: bad code -- http://master.php.net/note/delete/64604/bad+code Del: spam -- http://master.php.net/note/delete/64604/spam Del: non-english -- http://master.php.net/note/delete/64604/non-english Del: in docs -- http://master.php.net/note/delete/64604/in+docs Del: other reasons-- http://master.php.net/note/delete/64604 Reject -- http://master.php.net/note/reject/64604 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#108500) next »