Home » PHP » PHP Constants » Question
  1. What will be the output of the following PHP code ?
    <?php
    class newObject { }
    define('newObject::CONSTANT', 'Example');
    echo newObject::CONSTANT;
    ?>
    1. Error
    2. Example
    3. CONSTANT
    4. Nothing
    5. None of these
Correct Option: A

Class constants cannot be defined or redefined outside class.



Your comments will be displayed only after manual approval.