Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
What Is the Scope of a Variable Defined in a Function
What Is the Scope of a Variable Defined in a Function? - PHP Script Tips - Creating Your Own Functions
✍: FYIcenter.com
The scope of a local variable defined in a function is limited with that function. Once the function is ended, its local variables are also removed. So you can not access any local variable outside its defining function. Here is a PHP script on the scope of local variables in a function:
<?php
?>
function myPassword() {
$password = "U8FIE8W0";
print("Defined inside the function? ". isset($password)."\n");
}
myPassword();
print("Defined outside the function? ". isset($password)."\n");
?>
This script will print:
Defined inside the function? 1 Defined outside the function?
2007-04-24, 5320👍, 0💬
Popular Posts:
Rachel opened her math book and found that the sum of the facing pages was 245. What pages did she o...
How To Use Subqueries with the IN Operator? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqu...
How To Call a Sub Procedure? - Oracle DBA FAQ - Creating Your Own PL/SQL Procedures and Functions To...
How To Create an Add-to-My-Yahoo Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS News ...
What is the purpose of Replication ? Replication is way of keeping data synchronized in multiple dat...