using result of function in same line

From: Date: Thu, 06 Nov 2003 01:26:58 +0000
Subject: using result of function in same line
Groups: php.windows 
Request: Send a blank email to php-windows+get-22009@lists.php.net to get a copy of this message
ok here's the problem - in some languages (like javascript or c# for instance) you could use the results of a function in same line as your call. say you have a function foo that returns an array, you can do something like print foo()[4]; this will print the 5th element of whatever array foo returned. but in php, it seems like you have to break it up into 2 calls like this: $x = foo(); echo $x[4]; i find it hard to believe that you can't do echo foo()[4]; so... how can u go about this? thanks, igor and also, what is that called when you can do it in same line?

« previous php.windows (#22009) next »