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.

Dobromir Velev

-----Original Message-----
From: Jason Caldwell <[EMAIL PROTECTED]>
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 ??


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to