How to echo this array? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: How to echo this array? (/showthread.php?tid=69117) |
How to echo this array? - iridion2015 - 10-10-2017 Hi guys, I send an array $data['content'] into view. and here are the content of this array. Code: array(2) { Now how to echo 'subject_name' and 'author' using foreach? RE: How to echo this array? - PaulD - 10-10-2017 Well your question is a bit unclear. $data['content'] is the array $data with an element 'content'. Is the array you have shown the element 'content' or the array $data itself? In your controller something like: PHP Code: public function index() In your 'homepage.php' view file something like: PHP Code: <?php if ( ! empty($content)) { ?> I hope that helps but perhaps you were asking something more complicated that I have missed. Best wishes Paul. |