RE: [PHP] accessing localtime array directly

From: Date: Fri, 05 Oct 2001 21:51:23 +0000
Subject: RE: [PHP] accessing localtime array directly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70147@lists.php.net to get a copy of this message
php doesn't support automatic dereferencing of arrays, so you can't just throw the index on the back, but you could do this: $julianday = array_slice(localtime(),7,1); but then $julianday's an array...so you could wrap an array_pop around that......although it gets you your val in one line, i think it many cases, it's easier/better/more efficient to just grab the array in one line, then access and copy the val in the second line, as you did... jack -----Original Message----- From: John A. Grant [mailto:jazrant@zsc.nrcan.zc.ca] Sent: Friday, October 05, 2001 5:22 PM To: php-general@lists.php.net Subject: [PHP] accessing localtime array directly In Perl I have done this: $julianday=(localtime)[7]; Is there an equivalent syntax for PHP or do I just do: $now=localtime(); $julianday=$now[7]; I don't need it - I'm just curious about the syntax. -- John A. Grant * I speak only for myself * (remove 'z' to reply) Radiation Geophysics, Geological Survey of Canada, Ottawa If you followup, please do NOT e-mail me a copy: I will read it here -- 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

« previous php.general (#70147) next »