Google Ads

PHP RegEx: Case Insensitive PHP Script


PHP RegEx: Case Insensitive PHP Script

In previous tutorial we match at the beggining of the string given. But that is a case sensitive. If your condition like this: if(preg_match(“/^ABC/”, $string)) then the value of your string “abc”. The script will returned with this message:

No match found

This is because of case sensitive. But in this script we will make the condition insensitive using regex “i” for insensitive. Shown below:

 

 
 
  1. <?php // create a string
  2. $string = 'Ronard';
  3. // try to match our pattern
  4. if(preg_match("/^ron/i", $string)) {
  5. // echo this is it matches
  6. echo 'The string begins with Ron';
  7. } else {
  8. // if not match is found echo this line
  9. echo 'No match found'; }
  10. ?>

 

Even if your string given are ROn, rOn, RoN the script will read insensitive and display the message “The string begins with Ron”.

 

 


Related Post

LaraMailer – Email Marketing Application wit... LaraMailer - Email Marketing Application with Multiple SMTP Support PHP Script Hello Good People, Are you tired of making mail to your clients over...
RELEASED Days OF THE Week With Images PHP Script RELEASED Days OF THE Week With Images PHP Script This is a php script. You Can download from our site.   Download File  
emailChecker – Ultimate Email Hygiene! PHP S... emailChecker - Ultimate Email Hygiene!emailChecker - Ultimate Email Hygiene!The emailChecker class is the ultimate in usability and improving user exp...
PHP Text to Speech using Microsoft Speech API PHP ... PHP Text to Speech using Microsoft Speech API PHP Script Microsoft Speech APIThe Speech Application Programming Interfaceor SAPI is an API develope...
B2Evolution v6.6.9 Stable Blog PHP Script B2Evolution v6.6.9 Stable Blog PHP Script. Create a beautiful blog website using this php scrpt. b2evolution is an advanced weblog tool, i-e sof...

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

"