How can we define a variable accessible in functions of a php script?



How can we define a variable accessible in functions of a php script?..

Answer / Savita Gupta

To define a variable accessible in functions of a PHP script, you should use the `global` keyword inside the function to reference the global scope variable.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How to access a Static Member of a Class in PHP?

1 Answers  


What are the difference between array_keys() and array_key_exists() in php?

1 Answers  


What is the purpose of the '.myd' file extension? What do thes file contain?

1 Answers  


How to call javascript function in php on button click?

1 Answers  


What is the difference between md5(), crc32() and sha1() crypto on php?

1 Answers  


How to delete a file from the system?

1 Answers  


How to connect to a url in php?

1 Answers  


What does PEAR stands for?

1 Answers   Arigo Infotech,


What is helper function?

1 Answers  


What are getters and setters php?

1 Answers  


What is difference between php and wordpress?

1 Answers  


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

8 Answers   AZTEC, HCL, Navsoft,


Categories