Re: eregi and ereg??

From: Date: Fri, 14 Sep 2001 11:38:31 +0000
Subject: Re: eregi and ereg??
Groups: php.db 
Request: Send a blank email to php-db+get-12443@lists.php.net to get a copy of this message
Hi, You cannot put multiple variables in ereg(). This is taken from http://www.php.net/manual/en/function.ereg.php i think it will explain it better If matches are found for parenthesized substrings of pattern and the function is called with the third argument regs, the matches will be stored in the elements of the array regs. $regs[1] will contain the substring which starts at the first left parenthesis; $regs[2] will contain the substring starting at the second, and so on. $regs[0] will contain a copy of string. If ereg() finds any matches at all, $regs will be filled with exactly ten elements, even though more or fewer than ten parenthesized substrings may actually have matched. This has no effect on ereg()'s ability to match more substrings. If no matches are found, $regs will not be altered by ereg(). There are some code snippets that ilustrate the use of the $regs array. HTH Dobromir Velev -----Original Message----- From: Jason Caldwell <jason@thinkingman.org> To: php-db@lists.php.net <php-db@lists.php.net> Date: Friday, September 14, 2001 8:15 AM Subject: [PHP-DB] eregi and ereg?? www.php.net shows the proper format for EREG and EREGI is: int ereg (string pattern, string string [, array regs]) My question is this; I want to be able to compare 2 or more strings to the EREG(I) STRING PATTERN... without having to create two separate EREG(I) IF...THEN statements... If I understand the format as displayed above, then I should be able to put multiple variables in the EREG(I) expression... like so; if(eregi("x", $string1 $string2 $string3, $regs) Is this correct? Or, do I have to specify an IF...THEN type of statement for each $STRING ?? Thanks Jason jason@thinkingman.org

« previous php.db (#12443) next »