Au niveau de la maintenabilité, propreté de codage, temps d'execution, habitude de codage, ... quelle est la meilleur solution ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class A {
  private $_var ;
 
    function meth1(){
      $this->_var = 1;
      $this->meth2($this->_var);
    }
 
    function meth2($param){
      if( $param ) ...
    }
}
 
class B {
  private $_var ;
 
  function meth1(){
    $this->_var = 1 ;
    $this->meth2();
  }
 
  function meth2(){
    if( $this->_var ) ...
  }
}