Skip to content
Advertisement

understanding why echo doesnt work within a php class function

I’m trying to debug a class and using print_r and echo to view the variables as the script progresses.

However for some reason I can’t seem to get any output from within the function, i’ve declared the function public but can’t get any output using print, echo or print_r.

I’m misunderstanding something fundamental here – can anyone help please.

here’s some extract from my code:

this call is from within a public function within the class:

JavaScript

The method looks like this:

JavaScript

The print_r was purely to test the values were being passed, but I don’t get any output at all

Advertisement

Answer

Try somothing like this (add some if else statment):

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