"call to undefined function" error when calling class method
You dont have a function named assign()
, but a method with this name. PHP is not Java and in PHP you have to make clear, if you want to call a function
assign()
or a method
$object->assign()
In your case the call to the function resides inside another method. $this
always refers to the object, in which a method exists, itself.
$this->assign()
Mates,
I stumbled upon this error today while testing a simple script. I am not using "class" function though so it take it with grain of salt.I was calling function before its definition & declaration ...something like this
try{ foo(); } catch (exception $e) { echo "$e->getMessage()"; } function foo(){ echo "blah blah blah"; }
so php was throwing me error "call to undefined function ".
This kinda seem classic programming error but may help someone in need of clue.