Re: Use array returned by function directly?

From: Date: Mon, 29 Jan 2007 17:19:41 +0000
Subject: Re: Use array returned by function directly?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-247953@lists.php.net to get a copy of this message
ivailo91@gmail.com wrote:
What's the best way to achieve something like this: explode($needle, $array)[3] It's too clumsy to use temporary array, and I suppose, quite slow. Is there any option, or I'll have to stick to temporary arrays? Best Regards, Ivailo Karamanolev
I think you are meaning this: <?php $str = "zero@someplace.org,one@someplace.org,two@someplace.org"; echo explode(',', $str)[1]; ?> If it worked, this would return "one@someplace.org" I remember this discussion 7 years ago. This feature is not possible. IMO it would be a very handy feature! -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush

« previous php.general (#247953) next »