What is a static variable in php?



What is a static variable in php?..

Answer / Sonam Tyagi

A static variable in PHP retains its value between function calls. It is declared using the keyword 'static'. Static variables are initialized only once, at the first call of the function they are defined in.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

/temp is a type of filesystem directory. State Whether True or False?

1 Answers  


What are the difference between abstract class and interface in oops?

1 Answers  


What are the functions for imap?

1 Answers  


Suppose we receive a form submitted by a post to subscribe to a newsletter. This form has only one field, an input text field named email. How would we validate whether the field is empty? Print a message "the email cannot be empty" in this case?

1 Answers  


Is php still in demand?

1 Answers  


Can you pass an array into a function?

1 Answers  


How can we know the number of days between two given dates using PHP? How can we know the number of days between two given dates using MySQL?

6 Answers  


Is multilevel inheritance possible in php?

1 Answers  


Tell me how can we check the value of a given variable is alphanumeric?

1 Answers  


What is the use of mvc in php?

1 Answers  


Is php 7.0 stable?

1 Answers  


How can I reset an array in PHP?

4 Answers   Rushmore Consultancy, TCS,


Categories