php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11064 ereg() doe's not accept the third argument as reported in doc
Submitted: 2001-05-23 16:54 UTC Modified: 2001-05-24 15:45 UTC
From: jmt at freeshell dot org Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 4.0.5 OS: linux 2.2
Private report: No CVE-ID: None
 [2001-05-23 16:54 UTC] jmt at freeshell dot org
try this :
ereg( $a, $b, $c );

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-23 19:56 UTC] sniper@php.net
And what should happen? You try this:

<?php

$date = date("Y-m-d");

if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs)) {
    echo "$regs[3].$regs[2].$regs[1]";
} else {
    echo "Invalid date format: $date";
}   

?>

Works for me just fine.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 10:03:34 2021 UTC