CodeIgniter Forums
What $data[] stands for - 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: What $data[] stands for (/showthread.php?tid=71847)



What $data[] stands for - soneax - 10-01-2018

Hi,

I'm trying to learn more advanced PHP with Code Igniter and i'm starting from the Tutorial in Docs.

There in the News model i have:


Code:
$data['news'] = $this->news_model->get_news();


And in the view i have a foreach:


Code:
<?php foreach ($news as $news_item): ?>


Can i assume that $data['news'] is the same as $news?


RE: What $data[] stands for - ciadmin - 10-01-2018

Correct ... see https://www.codeigniter.com/user_guide/general/views.html#adding-dynamic-data-to-the-view


RE: What $data[] stands for - soneax - 10-01-2018

Thank you!