AndrewDavidson.com.  We don't reinvent the wheel... we just make reinventing the wheel easier. Visit PDFCalendar.com for free customizable printable calendars.
Home
Resources
Software
Links
Articles
About
About Drew
Contact
Feedback
Subscribe to our Newsletter:
Printer-Friendly
© 1999-2024
Andrew Davidson.
All Rights Reserved.

Where is PHP strcmpi?

Copyright © 2006 Andrew B. Davidson. All Rights Reserved.
Last Updated: April 2006

Aren't all PHP functions named the same as in C/C++?

No. Many PHP functions do in fact have the same name as their C/C++ counterparts. Regardless, strcmpi and stricmp are not standard C/C++ functions.
The C/C++ functions strcmpi (or stricmp or _strcmpi), have no identically named function in PHP.
However, the equivalent binary-safe case-insensitive string comparison function in PHP is called strcasecmp. It is defined as follows:
int strcasecmp ( string str1, string str2 )

Returns < 0 if str1 is less than str2 ; 
> 0 if str1 is greater than str2 , 
and 0 if they are equal.
The strcasecmp() function is available in PHP 3.0.2 or higher, PHP 4, and PHP 5, so you should have no trouble using this in your PHP scripts.
I hope this information helps your PHP web development efforts!

Comments?

If you have an comments or suggestions on this technique, you can email me at AndrewDavidson {at} AndrewDavidson {dot} com, or use my Feedback Form if you prefer.