Is it okay to declare the variable any part of your class ? I have this code, I am using laravel 5.1 framework
In my controller
public function myTest(){
$i = 0;<--- is it okay to declare if we use oop,or we should put on top and declare private.
foreach($myarray as $arr){
// do something
// do something with $i
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire