note 26058 added to function.str-replace

From: Date: Wed, 16 Oct 2002 14:28:07 +0000
Subject: note 26058 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-38164@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. -- http://www.php.net/manual/en/function.str-replace.php http://master.php.net/manage/user-notes.php?action=edit+26058 http://master.php.net/manage/user-notes.php?action=delete+26058 http://master.php.net/manage/user-notes.php?action=reject+26058

« previous php.notes (#38164) next »