note 88136 added to function.strpos

From: Date: Mon, 12 Jan 2009 13:22:36 +0000
Subject: note 88136 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-149093@lists.php.net to get a copy of this message
To make it easier to test positively whether a string contains something, I use a custom function named "contains": function contains($mystring, $findme) { if (strpos($mystring, 'a') !== false) { return true; } else { return false; } } I use it like: if ( contains($mystring, 'a') ) { echo 'String contains "a".'; } ---- Server IP: 209.41.74.194 Probable Submitter: 74.208.16.95 ---- Manual Page -- http://www.php.net/manual/en/function.strpos.php Edit -- https://master.php.net/note/edit/88136 Del: integrated -- https://master.php.net/note/delete/88136/integrated Del: useless -- https://master.php.net/note/delete/88136/useless Del: bad code -- https://master.php.net/note/delete/88136/bad+code Del: spam -- https://master.php.net/note/delete/88136/spam Del: non-english -- https://master.php.net/note/delete/88136/non-english Del: in docs -- https://master.php.net/note/delete/88136/in+docs Del: other reasons-- https://master.php.net/note/delete/88136 Reject -- https://master.php.net/note/reject/88136 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149093) next »