php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #12340 ereg's documentation is wrong
Submitted: 2001-07-24 10:37 UTC Modified: 2001-07-24 10:42 UTC
From: baumann at valudo dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: baumann at valudo dot de
New email:
PHP Version: OS:

 

 [2001-07-24 10:37 UTC] baumann at valudo dot de
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-24 10:42 UTC] andy@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 12:01:33 2025 UTC