« Programmation PHP/Constantes » : différence entre les versions
Contenu supprimé Contenu ajouté
m typo |
mAucun résumé des modifications |
||
Ligne 28 :
define("CONSTANTE", "Texte ici");
echo CONSTANTE; // affiche "Texte ici"
</syntaxhighlight>
Ligne 47 ⟶ 46 :
$instance = new MaClasse;
$instance->afficher();
</syntaxhighlight>
Ligne 62 ⟶ 60 :
define ("CONSTANTE", ["a", "b", "c"]);
print_r(CONSTANTE);
</syntaxhighlight>
Ligne 72 ⟶ 69 :
define ("CONSTANTE", "deuxième définition"); // ignoré
echo CONSTANTE; // retournera toujours "première définition"
</syntaxhighlight>
Ligne 127 ⟶ 123 :
$test = new test();
$test->foo();
</syntaxhighlight>
Qui affichera:
|