note 26058 rejected from function.str-replace by maxim
| From: | maxim@php.net | Date: | Wed, 16 Oct 2002 15:29:59 +0000 |
| Subject: | note 26058 rejected from function.str-replace by maxim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-38173@lists.php.net to get a copy of this message | ||
I've used this function to translate a readable date string in ISO format for a SAPDB system:
function date2sapdb($date)
{
//$date = "06.04.2002";
list($day, $month, $year) = split(".",$date,3);
$date = $year."-".$month."-".$day;
echo $date;
}
-> will output: ".04.2002--" huuuh? :(
now i've replaced the "." with "-" and did the same split again. Now it
will work:
function date2sapdb($date)
{
//$date = "06.04.2002";
$date = str_replace(".","-",$date);
list($day, $month, $year) = split("-",$date,3);
$date = $year."-".$month."-".$day;
echo $date;
}
-> will output 2002-04-06 - it work's :)
Tested on Windows NT 5.0 build 2195 with Apache/1.3.23 (Win32) and PHP V4.1.1.
Is it a bug/feature? - but i don't think so.