Constant definition is considered a static member of the class : const « Class « PHP






Constant definition is considered a static member of the class

 
<?php
class myclass {
  const MYCONST = 123;
  private static $value = 567;
}

echo 'myclass::MYCONST = ' . myclass::MYCONST . "\n";
echo 'myclass::$value = ' . myclass::$value . "\n";
?>
  
  








Related examples in the same category

1.Counting the elements in an array
2.Finding the size of an array
3.Using Class Constants
4.Using Class Constants in PHP5