Strings with leading zeros

From: Date: Thu, 28 Dec 2000 20:21:19 +0000
Subject: Strings with leading zeros
Groups: php.general 
Request: Send a blank email to php-general+get-32139@lists.php.net to get a copy of this message
Hi, I have a field returned to me from a remote database, a 8-digit number, MMDDYYYY, which I split up to get a date to use in further calculations. This field mostly has a leading zero for months from Jan through September; despite explicitly setting the type to a string, if there is a leading zero everything goes wrong. For example, if the field is 01102001, substr($field, 0, 2) returns 29, and the whole field is 295937! This seems to be related to bug #5404, I think. Can anybody suggest a workaround so that I can get 01 thru 09 in as my month? Many thanks, Charlie

« previous php.general (#32139) next »