vendredi 8 octobre 2021

PHP Declare method in class if statement

In PHP, is it possible to declare a method in a class only if a statement is true :

class MyClass {

    //...
    
   
    if (mode === 'production'):
    public function myMethod() {
        // My cool stuffs here        
    }
    endif;
}

Aucun commentaire:

Enregistrer un commentaire