PHP Classes

ereg usage

Recommend this page to a friend!

      Ultimate MySQL  >  All threads  >  ereg usage  >  (Un) Subscribe thread alerts  
Subject:ereg usage
Summary:Change ereg to strpos
Messages:2
Author:-
Date:2010-05-22 11:58:58
Update:2010-12-23 16:09:22
 

  1. ereg usage   Reply   Report abuse  
Picture of - - - 2010-05-22 11:58:59
Hi,

first of all: Great wrapper class you've developed here!

When I use your class in PHP 5.3 I get two E_DEPRECATED warnings regarding ereg calls.

I suggest you replace the two lines 1087 and 1097 with
"if (strpos(strtolower($sql),"insert")===0) {"
and
"} else if(strpos(strtolower($sql),"select")===0) {".

Instead of using regular expressions here I think strpos is better, as it is faster (no need for compilation of the regular expression, see http://lzone.de/articles/php-string-search.htm ).

  2. Re: ereg usage   Reply   Report abuse  
Picture of Jeff Williams Jeff Williams - 2010-12-23 16:09:23 - In reply to message 1 from -
Thank you! I have added it to the latest version.