Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

  1. What will be the output of the following PHP code ?

    <?php

    class myObject { }

    define('myObject::CONSTANT', 'test');

    echo myObject::CONSTANT;

    ?>

  2. A.

     test

    B.

     error

    C.

     myObject::CONSTANT

    D.

     no output

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    Class constants cannot be defined outside class.


Be The First To Comment