Re: Do I mistake with type of VARIABLES ?

From: Date: Thu, 15 Jun 2000 19:04:26 +0000
Subject: Re: Do I mistake with type of VARIABLES ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1989@lists.php.net to get a copy of this message
Hi Svetlin, date ('m') will return the month with a leading 0. The reason that $month + 0 works is that this causes the string to be converted to an integer - thus removing the leading 0. You could use date ('n') instead of date ('m') - the month will not have a leading 0 then. HTH, Zak At 09:58 PM 6/15/00 +0200, Svetlin Simeonov wrote:
Hi, guys can anyone tell me why this script prints only the second string ?!? I can't understand exatly but i think that $month is char value and this confuse the script - but why when I make $month+0 - It works ? Where I mistake ? <? $month_name = array( 0=> array ("","ñÎÕÁÒÉ","æÅ×ÒÕÁÒÉ","íÁÒÔ","áÐÒÉÌ","íÁÊ","àÎÉ","àÌÉ","á×ÇÕÓÔ","óÅÐÔÅÍ×ÒÉ","ïËÔÏÍ×ÒÉ","îÏÅÍ×ÒÉ","äÅËÅÍ×ÒÉ"), 1=> array ("","ñÎÕ","æÅ×","íÁÒ","áÐÒ","íÁÊ","àÎÉ","àÌÉ","á×Ç","óÅÐ","ïËÔ","îÏÅ","äÅË") ); $month=date("m",time()); echo $month_name[0][$month]."|||".$month_name[0][$month+0]; ?> It prints in the browser |||àÎÉ And in my error log: [Thu Jun 15 21:48:15 2000] [error] PHP Warning: Undefined index: 06 in /apache/htdocs/test12.php on line 12 -- Best Regards, Svetlin Simeonov -- 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
Zak Greant Creative Director Nucleus Information Service Inc. "I am rather like a mosquito in a nudist camp: I know what I ought to do, but I don't know where to begin." - Stephen Bayne

« previous php.general (#1989) next »