RE: [PHP] [BUG?] substr giving strange results
| From: | Jack Dempsey | Date: | Tue, 09 Oct 2001 14:05:47 +0000 |
| Subject: | RE: [PHP] [BUG?] substr giving strange results | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70475@lists.php.net to get a copy of this message | ||
string substr (string string, int start [, int length])
3rd param is length
jack
-----Original Message-----
From: Jean-Christian Imbeault [mailto:jean_christian@hotmail.com]
Sent: Tuesday, October 09, 2001 9:54 AM
To: php-general@lists.php.net
Subject: [PHP] [BUG?] substr giving strange results
Ok, either I missed something really simple or ...
Here's the code:
$comp = trim($data->comp);
$YY = substr($comp,0,3);
$MM = substr($comp,5,6);
$DD = substr($comp,8,9);
echo "COMP is $comp<BR>";
echo "DATE is $YY" . "," . "$MM" . "," . $DD;
The results are:
COMP is 2002-10-29
DATE is 200,10-29,29
Now, shouldn't it be:
COMP is 2002-10-29
DATE is 2002,10,29
This exact code snippet works fine one another page but not this one ...
What is the obvious thing I am not seeing?
Jc
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net