[Phpmyadmin-devel] PHP3 -> PHP4
Michal Cihar
nijel at users.sourceforge.net
Thu Nov 20 07:10:06 CET 2003
Hi
Original message (Garvin Hicking, 20.11.2003 15:59):
> Who wants to make this function from libraries/sqlparser.lib.php
> PHP4-enhabled? As I'm not familar using strpos/strcomp and really don't
> know what the function is about, I don't want to screw that one up. :-)
I's quite simple :-)
> --------------
> function PMA_SQP_typeCheck($toCheck, $whatWeWant)
> {
> $typeSeperator = '_';
> if(strcmp($whatWeWant, $toCheck) == 0) {
> return TRUE;
> } else {
Just uncomment this:
> //if(strpos($whatWeWant, $typeSeperator) === FALSE) {
And remove these two lines:
> // PHP3 compatible (works unless there is a real ff
> character)
> if(!strpos("\xff" . $whatWeWant, $typeSeperator)) {
> return strncmp($whatWeWant, $toCheck ,
> strpos($toCheck, $typeSeperator)) == 0;
> } else {
> return FALSE;
> }
> }
> }
> ---------------
Meybe it would be faster to store result of first strpos into variable
and use it then in strncmp, but it depends what comsumes more time...
--
Regards
Michal Cihar
http://cihar.com
More information about the Developers
mailing list