Welcome Guest, Not a member yet? Register   Sign In
Access returned array directly
#1

[eluser]evolutionxbox[/eluser]
I am using the calendar class and its function 'adjust_date()'.

It returns an array depending on what I put in:
Code:
Array ( [month] => 04 [year] => 2010 ) 1

This is how I get to it so far:
Code:
$date = $this->calendar->adjust_date($month, $year);
$adjusted_month = $date['month'];

How can I access the return array straight off the bat? I was thinking of something like this:
Code:
$date = $this->calendar->adjust_date($month, $year)->['month'];

This doesn't work... any ideas?
#2

[eluser]adamp1[/eluser]
Edit:
I think you will have to use the temp variable. Someone asked the same question here http://stackoverflow.com/questions/13109...on-the-fly
#3

[eluser]evolutionxbox[/eluser]
Ah well, one more line of code won't hurt.




Theme © iAndrew 2016 - Forum software by © MyBB