note 18796 added to function.ereg
| From: | marcos at iqc-services dot com | Date: | Wed, 06 Feb 2002 01:56:12 +0000 |
| Subject: | note 18796 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26278@lists.php.net to get a copy of this message | ||
Here a example using regular expresions:
function us2esdate( $date)
{
ereg("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})$", $date, $c);
$year = &$c[1];
$month = &$c[2];
$day = &$c[3];
return "$day-$month-$year";
}
function es2usdate( $date)
{
ereg("^([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})$", $date, $c);
$year = &$c[3];
$month = &$c[2];
$day = &$c[1];
return "$year-$month-$day";
}
PHP is great, marco no curres tanto..
--
http://www.php.net/manual/en/function.ereg.php
http://master.php.net/manage/user-notes.php?action=edit+18796
http://master.php.net/manage/user-notes.php?action=delete+18796
http://master.php.net/manage/user-notes.php?action=reject+18796