Merging Strings

From: Date: Tue, 03 May 2005 09:48:24 +0000
Subject: Merging Strings
Groups: php.general 
Request: Send a blank email to php-general+get-214371@lists.php.net to get a copy of this message
Hi all, why do result the following two examples in two different value for $month? (1) $current_date = getdate(time()); $month = strval($current_date['year']); $month .= (strlen(strval($current_date['mon'])) == 2)?$current_date['mon']:("0".$current_date['mon']); (2) $current_date = getdate(time()); $month = strval($current_date['year']) . (strlen(strval($current_date['mon'])) == 2)?$current_date['mon']:("0".$current_date['mon']); The first example sets $month to 200505 and the second sets it to 5. Why is that. In my opinion they both should set it to 200505. Is this a weird bug, or did i something wrong? I'm using PHP 4.3.10 with Apache 1.3.33 on W2K Pro, but the server of my hosting provider does the same (php 4.3.10 + apache (don't know the version, i guess 1.3.33) on linux (i'm not sure, but i thought it was redhat)). Rolf van de Krol

« previous php.general (#214371) next »