In this tutorial, you will learn about self operator and its uses in PHP
The self keyword represents current and static members of the class.
Syntax
self :: $static_member
Uses with Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php class FOT { private static $static_member = "Onlinetest"; function __construct() { echo self::$static_member; // Accessing static variable } } new FOT(); ?> |