[solved] Help understanding this notation

Hi Guys!

I found this useful part of code which works,

but I do not understand one part of it.

Okay, lets say you have following functions in your model:

public static function getMyItemList()


	return [

		0 => 'Zero',

		1 => 'One',

		2 => 'Two', 

		3 => 'Three',

		4 => 'Four'



public function getMyItemLabel()


	return self::getMyItemList()[$this->item]; // <---- this is what I do not understand.


The [$this->item] comes directly after the function call?

I’m used to for example getMyItemList($myParam) and return the selected item in getMyItemList.

But this "getMyItemList()[$this->item]" is new to me.

Could someone please explain it or can tell me how it is "called"?

Then I will find it myself I think.

Thank you and best regards

Since PHP 5.4 it’s possible to do exactly that:


Reference: http://php.net/manual/en/language.types.array.php#example-102

Prior to PHP 5.3, you’ll need to use a temporary variable.


Thanks a lot!