CodeIgniter Laravel PHP Example Javascript jQuery MORE Videos New
Need a Website Or Web Application Contact : +91 9437911966 (Whatsapp) Note: Paid Service

How to Pass multiple Arrays to view in codeigniter

METHOD 1 Same variable name change key


public function index() 
{
   $data['data1']=$this->load_city->view();
   $data['data2']=$this->load_city->spl();
   $this->load->view('home_view',$data);
}  

METHOD 2 Merge Your array

    public function index() 
{
   $data['data1']=$this->load_city->view();
   $data2['data2']=$this->load_city->spl();
   $new_array = array_merge($data,$data2);
   $this->load->view('home_view',$new_array );
}

if you want to make shortcut just add direct in method

$this->load->view('home_view',array_merge($data, $data2));