Function result is an array
| From: | Dustin Mitchell | Date: | Sat, 31 May 2003 01:52:08 +0000 |
| Subject: | Function result is an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149630@lists.php.net to get a copy of this message | ||
I briefly tried searching the archives for this, but there aren't any handy
keywords, so I didn't find anything. Why can't I do this:
$year = getdate($timestamp)['year'];
(syntax error) while I can do this:
$temp = getdate($timestamp);
$year = $temp['year'];
and is there a way to combine the above into one statement, however
ungainly?
This doesn't just happen with getdate -- it happens with any function
returning an array. I'm using PHP 4.1.2.
Dustin
--
Dustin Mitchell
dustin@ywlcs.org/djmitche@alumni.uchicago.edu
http://people.cs.uchicago.edu/~dustin/