mardi 30 août 2016

Assocative array working in Codeignator

I am learing Codignator. One question in my mind is teasing me how this is working internally.

I have a controller like TestController and I have passed and assocative array to my view named TestView. Assocative array is like.

$options = array(
          'small'  => 'Samsung',
          'med'    => 'Apple',
          'large'   => 'HTC',
          'xlarge' => 'Nokia');   

I am loading the view with above array.

$this->load->view('TestView', $options);

inside the view I can access these Assocative array Index as vairables. Like

echo $small;
echo $med;
echo $large;
echo $xlarge;

I am confused how this is working.




Aucun commentaire:

Enregistrer un commentaire