Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php access const in class

<?php
class MyClass
{
    const CONSTANT = 'constant value';

    function showConstant() {
        echo  self::CONSTANT . "
";
    }
}

echo MyClass::CONSTANT . "
";
?>
 
PREVIOUS NEXT
Tagged: #php #access #const #class
ADD COMMENT
Topic
Name
8+5 =