To further clarify, I am wanting to find out if it is bad practice to duplicate a method / function, say it has a different while loop or slightly different variables etc.
See below, these are two different functions, should I create one giant multi pupose function or keep them as two seperate, which is best practice?
Sometimes you can fit everything within 1 function but not sure if that should always be the case or if there is a best practice for minimizing copy / paste scenarios or it doesnt really matter?
PHP Code:function method1($data) {
$mydate = $data;
$test = $this->load->view('testpage',$mydata);
}
function method2($data) {
$otherdata= $data;
$test = $this->load->view('anotherpage',$otherdata);
}



Reply With Quote



Bookmarks