answersLogoWhite

0

What is the Use of static function?

User Avatar

Anonymous

10y ago
Updated: 8/16/2019

A static function is a member function that is not associated with any instance of the class; it has no this pointer.

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

How do you create static variables in PHP?

Use the "static" keyword to declare a static variable within a function like shown below. <?php function fun() { static $variable; static $another_variable = ''; } ?>


What is the function of static relay?

function of static relay


What is function of static relay?

function of static relay


What is the difference between static function and global static function?

'global static'?! There is no such thing.


What are some things that use static electricity to function?

Some common things that use static electricity to function include photocopiers, printers, air purifiers, and paint sprayers. Static electricity is used in these devices to attract particles, create a static charge for imaging, or facilitate the transfer of paint particles.


Why static functions cannot use instant variables?

Static functions are tied to a class, not to a particular object. A static function can only access static variables because it has no knowledge of member variables.


Scope of static variables?

Scope of static variable is with in the file if it is static global. Scope of static variable is with in the function if variable is declared local to a function. But the life time is throughout the program


When Static function can work with static data member only?

Always.


Can static member function be overloaded?

Yes. Any function can be overloaded. However you cannot override a static member function. Only instance members can be overridden.


What is a static variable within a PHP function?

A static variable is a variable that retains it's value over multiple calls to the function. When it is defined using the static keyword, that defining value is applied only on the first use. For example: function foo(){ static $bar = 5; $bar++; echo $bar . "\n"; } foo(); foo(); foo(); foo(); foo(); This code would output the following: 6 7 8 9 10


Do static variable retain their values even after exiting the function?

Yes. That is the definition of static.


Why static variables in a function have global extent?

A variable declared static outside of a function has a scope the of the source file only. It is not a global variable. A variable declared outside of a function and without the static qualifier would be a global variable.