Jump to content

Recommended Posts

Posted

Basically never. Others have asked for it, but it's likely that it won't happens for a while. When it finally does happen, it'll be updated on Johnny.

 

I've been here 3 years, and as far as i can remember, php has never been updated in any meaningful way.

Posted

That's fair enough :) . Still learning a lot about php, and found out what to do if function array dereferencing isn't an option.

 

It's simple and probably obvious enough, but just incase someone stumbles upon this looking for info on what to do if function array dereferencing isn't available,

 

w/ FAD example:

 

return $this->results()[0];

 

w/o FAD example:

 

list($first_value) = $this->results();

return $first_value;

 

 

I hope those examples are enough to show the difference :P .

 

Also, if the above examples seem to be of any use, might a mod add tags to this thread equivalent to something like "Function" "Array" "Dereferencing" ? I don't see an option to do it myself.

Posted

When I need to do something like that (returning value X of an array that comes from a function/method):

 

$aTemp = $this->results();

return $aTemp[0];

 

I do this because it saves the entire results() output in case you want to put code between the definition of $aTemp and return.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...