[PHP-DOC] Bug #12340 Updated: ereg's documentation is wrong From: andy <email protected>
Date: 07/24/01

ID: 12340
Updated by: andy
Reported By: baumann <email protected>
Old Status: Open
Status: Bogus
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 4.0.6
New Comment:

Try looking at a script like this:

<?
ereg("(.*)\.(.*)","25.67",$regs);
for ($i=0;$i<count($regs);$i++){
echo "$i -- $regs[$i]<br>";
}
?>

regs[0] will have "25.67"
regs[1] will have "25"
regs[2] will have "67"

The documentation is correct.

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

[2001-07-24 10:37:00] baumann <email protected>

Hi there,

I'm sad to tell you, that I think to have found an error in your documentation or in PHP (that's up to you guys :)

When I was trying to find a pattern in a string with ereg, I did not get any result in $regs[1] as you wrote. I found it in $regs[0] where the copy of the whole string supposed to be. So I think that's a mistake, isn't it??

But anyway, good work folks,

c ya...

Tom

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

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