ID: 10154
Updated by: sander
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: *Regular Expressions
Operating System: Linux/NT
PHP Version: 4.0.4pl1
New Comment:

>From the manual:
"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."

Previous Comments:
------------------------------------------------------------------------

[2001-04-04 06:44:26] [EMAIL PROTECTED]

I'm not sure, if it's really an error or "feature" :). I would like to get $regs[10] 
value, but the output is always empty.

<script language="php">
$string = "1234567890";

ereg( "^(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)", $string, $regs);

echo "Whole string: " . $regs[ 0 ] . "<br>";
for ( $i = 1; $i <= 10; $i++ )
{
        echo "<br>" . $i . " -> " . $regs[$i];
}
</script>


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=10154&edit=1


-- 
PHP Development 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