1<?php
2/**
3 * we don't need to make object of static variable
4 * when we want to call function but not constructor then we can use constructor
5 */
6class A
7{
8 static public $num = 3;
9 function __construct()
10 {
11
12 }
13 static function fun1() {
14 echo "test<br>";
15 echo self::$num; //static function inside we can't use this keyword.
16 }
17}
18$obj = new A();
19// echo $obj->num; -we can't access static data like this
20// echo $obj->fun1(); -we can't access static data like this
21echo A::$num; //we can access static variable like this
22echo A::fun1(); //we can access static function like this
23?>