Mega Code Archive

 
Categories / Php / Language Basics
 

Using the static modifier to change a member or method so it is accessible without instantiating the class

<?php  class myclass {      const MYCONST = 123;           static $value = 567;  }  echo 'myclass::MYCONST = ' . myclass::MYCONST . "\n";  echo 'myclass::$value = ' . myclass::$value . "\n";  ?>