Skip to content
Advertisement

Calling other function in the same controller?

I’ve this controller, and the function read($q) return error Call to undefined function sendRequest()

JavaScript

I’m assuming it’s because I’m referencing the function in the wrong manner, but I can’t find any explanations for how to do it.

Advertisement

Answer

Try:

JavaScript

Since PHP is not a pure object-oriented language, it interprets sendRequest() as an attempt to invoke a globally defined function (just like nl2br() for example), but since your function is part of a class (InstagramController), you need to use $this to point the interpreter in the right direction.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement