dimanche 28 février 2016

When Refectring the current statmement

When I try to refecter commented into the static method, its return null. Other wise its ok. why ?

    public static  function Table($input) {
      $name = 'gazett_'.$input['ExamYear'].'_'.$input['gender'].'_'.$input['Examtype'];
      //        $obj = new static;
      //        $obj->setTable($name);
      //        return $obj; if i return insetance its ok, but in given below its return null why ?

      return (new static)->setTable($name);
    }

Here how return current instance from static method ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire