Home >> PHP >> What is static method in PHP

What is static method in PHP

* Static method  takes the memory durring the class loading time.

* Static method take the memory one time.

* Static method can directally accessible without creating object of class.

class::Methodname

Example:

Class Test{
       static function abc ($part1,$part2){
               echo " $part1,$part2";
       }
}
test:: abc("Raj","Ajay");

Output:

Raj, Ajay

Post Your Comment

Next Questions
What is constructor
Why use constructor
Predefined constructor
Parameterized constructor
What is destructor
What is Polymorphism
What is Polymorphism types
What is overloading
What is overriding
What is abstraction
What is abstract class
Implementation of abstract method
What is interface
What is difference between abstract class and interface
What is inheritance
Inheritance types
What is single inheritance
What is multiple inheritance
What is multilevel inheritance
How to use static method and property in inheritance
How to use self and parent with static
How to use self and parent without static
What is visibility
What is the difference between public, private, and protected
What is final

Copyright ©2022 coderraj.com. All Rights Reserved.