mercredi 27 mai 2020

Need correct way of if conidtions php


    if($data['params']['by'] == "date" && $data['params']['cnstr_type'] == "1"){
      $this->load->view('profile/report_view/page1', $data);
    } elseif($data['params']['by'] == "date" && $data['params']['cnstr_type'] == "2") {
      $this->load->view('profile/report_view/page2', $data);
    } elseif($data['params']['by'] == "week" && $data['params']['cnstr_type'] == "1") {
      $this->load->view('profile/report_view/page3', $data);
    } elseif($data['params']['by'] == "week" && $data['params']['cnstr_type'] == "2") {
      $this->load->view('profile/report_view/page4', $data);
    }

Is there any better way to improve this code

Aucun commentaire:

Enregistrer un commentaire