php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10154 Function ereg array results
Submitted: 2001-04-04 06:44 UTC Modified: 2001-08-31 06:26 UTC
From: crash at musichall dot cz Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 4.0.4pl1 OS: Linux/NT
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: crash at musichall dot cz
New email:
PHP Version: OS:

 

 [2001-04-04 06:44 UTC] crash at musichall dot cz
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>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-31 06:26 UTC] sander@php.net
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."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC