Question
What is the scope of a variable defined outside a function?

Answers

A variable defined outside any functions in main script body is called global variable. However, a global variable is not really accessible globally any in the script. The scope of global variable is limited to all statements outside any functions. So you can not access any global variables inside a function. Here is a PHP script on the scope of global variables:
?>
$login = "pickzycenter";
function myLogin() {
print("Defined inside the function? ". isset($login)."
");
}
myLogin();
print("Defined outside the function? ". isset($login)."
");
?>
This script will print:
Defined inside the function?
Defined outside the function? 1   Your Comment




More Software Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?

What is marker interface?

What types of partitioning are there for BW?



Search
Can you Answer!!
  • Q Understand that companies invest a lot of money into hiring the right staff. You want to emphasize that you are in it for the long run and you want to develop a career there and that it's not just a "5 month stepping stone" type of a job. You should be thinking how you're going to grow with that company for the next few years. After all, don't you want to invest your energy and time with a company that is going to continue to be successful and one that will help you grow?
  • Q Blue revolution is associated with which of the followings
  • Q Moderators are used in the nuclear reactors to?
  • Q What number gives its name to the cultish 'club' celebrating rock stars who died at that age?
  • Q Write any two maxims of learning Mathematics.
  • Q Name the author of ‘Studies in Co-ordinate Indexing’ (Vols. 1- 6)?
  • Q An ordinance must have passed by both houses in joint sitting by-
  • Q How to get @@error and @@rowcount at the same time?
  • Q When you call, do you use my company's name - or do you call as marketing connections?
  • Q Who had a hit with Tiger Feet
  • Q Where do Sweat glands occur in greatest number?