note 42794 rejected from function.eregi by betz

From: Date: Sat, 29 May 2004 19:37:36 +0000
Subject: note 42794 rejected from function.eregi by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70282@lists.php.net to get a copy of this message
Note Submitter: aleczapka <at> gmx net ---- This function is _not_ identical to ereg as it seems. I am running PHP 4.3.6 and trying to do simple thing. <?php if (ereg("^SELECT|SHOW|EXPLAIN|DESCRIBE", $sql)) { //do something - this works } ?> This works ok, but <?php if (eregi("^SELECT|SHOW|EXPLAIN|DESCRIBE", $sql)) { //do something - this won't work } ?> Does not! So far I can tell it is related to the lenght of the string I am checking. eregi works fine for some (short) strings, but it fails to match the pattern with the long strings. This is a dump of my string string(11130) "UPDATE test_data SET uid='1', gid='1', perm='664', data='Some long page body... (cut here)..." The string is cutted for the sake of the example.

« previous php.notes (#70282) next »