note 47805 added to function.stristr

From: Date: Wed, 01 Dec 2004 01:39:46 +0000
Subject: note 47805 added to function.stristr
Groups: php.notes 
Request: Send a blank email to php-notes+get-81205@lists.php.net to get a copy of this message
Here is the most simple way to check if an occurance of a string has occured, but case insensitive. <?php function in_istr ($hay, $needle) { if( strpos(strtolower($hay), strtolower($needle)) ){ return true; } } ?> or this if you don't mind it returning the position: <?php function in_istr ($hay, $needle) { return strpos( strtolower($hay), strtolower($needle) ); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.stristr.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47805 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47805&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47805&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47805&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47805&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47805&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47805&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47805&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81205) next »