user1611830
user1611830

Reputation: 4867

what does mean array($this, $some_method_string )?

Sorry if it might appear very simple, but what does that mean:

array($this, $some_method_string)

in this piece of code:

array_map(array($this, $some_method_string), $some_data)

Upvotes: 10

Views: 4952

Answers (2)

yunzen
yunzen

Reputation: 33439

You have a function with a name, e.g. function my_function ....

You have to give the name of that function as a string or string variable.

Upvotes: 0

mpm
mpm

Reputation: 20155

array($this, $some_method_string)

it is a valid callback , calling the method $some_method_string on $this :

with array_map , for every element of $some_data , call $this->$some_method_string(currentElement)

Upvotes: 8

Related Questions