How to var_dump from CodeIgniter controller
Based on PHP var_dump()
documentation, var_dump()
LINK doesn't return, it only outputs.
Therefore you can use output buffering PHP function like the following:
<?php ob_start(); var_dump($data); $result = ob_get_contents(); //or ob_get_clean() //ob_end_clean() ?>
var_export($variable, true) will do what you want. Basically you need to return a string, not echo directly. Which is what var_dump does. I suppose you could use output buffering but thats a bit... too much.