Sam Sam -4 years ago 107
PHP Question

How to get all the variables available in a view in PHP?

I need to see all the variables that are available in a view. I am a front end developer so I mostly work in the views directory. I don't always know which variables are being passed to the templates by the back end dev. Instead of asking him every time an easy solution would be some type of snippet that I can temporarily paste into the view that I'm working on so I can see all the available variables and even better if I can also see their types and values.

I tried this:

<pre><?php var_dump(get_defined_vars()); ?></pre>

But since I am using Codeigniter it also shows all the other tons and tons of variables that are passed in by the framework.

I only want to display the variables that were passed specifically from the controller that loaded the view. Is there any way to do this?

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download