RE: [PHP] Array element from function return
| From: | Wouter van Vliet | Date: | Sun, 24 Aug 2003 15:41:54 +0000 |
| Subject: | RE: [PHP] Array element from function return | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160590@lists.php.net to get a copy of this message | ||
Hmm .. thanks .. but shortly after posting I came to this idea that I might
want to use array_shift(); for this one .. works with numerical indices ....
Out of interest, is it really impossible to get such a thing for string
indices?
-> -----Oorspronkelijk bericht-----
-> Van: John W. Holmes [mailto:holmes072000@charter.net]
-> Verzonden: zondag 24 augustus 2003 17:34
-> Aan: Wouter van Vliet
-> CC: PHP General
-> Onderwerp: Re: [PHP] Array element from function return
->
->
-> Wouter van Vliet wrote:
->
-> > I'm trying to get the first element of a value returned by a
-> function ..
-> >
-> > == example ==
-> > function return_Array() {
-> > return ('one', 'zwei', 'kolm', 'vier');
-> > }
-> >
-> > print return_Array()[0];
-> > ==/ example ==
-> >
-> > Now i'd like this script to print 'one' for me .. can it be
-> done without
-> > creating a temporary variable?
->
-> No, use a temporary variable.
->
-> --
-> ---John Holmes...
->
-> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
->
-> php|architect: The Magazine for PHP Professionals – www.phparch.com
->
-> --
-> PHP General Mailing List (http://www.php.net/)
-> To unsubscribe, visit: http://www.php.net/unsub.php
->