SóProvas


ID
3220012
Banca
VUNESP
Órgão
FUNDUNESP
Ano
2016
Provas
Disciplina
Programação
Assuntos

O código que define corretamente uma constante em PHP é:

Alternativas
Comentários
  • E

  • e-

    Constants can be defined using the const keyword, or by using the define()-function. While define() allows a constant to be defined to an arbitrary expression, the const keyword has restrictions. Once a constant is defined, it can never be changed or undefined.

    <?php

    define("CONSTANT", "Hello world.");

    echo CONSTANT; // outputs "Hello world."

    echo Constant; // Emits an Error: Undefined constant "Constant"

                  // Prior to PHP 8.0.0, outputs "Constant" and issues a warning.

    ?>

    https://www.php.net/manual/en/language.constants.syntax.php