Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Access a Global Variable inside a Function
How To Access a Global Variable inside a Function? - PHP Script Tips - Creating Your Own Functions
✍: FYIcenter.com
By default, global variables are not accessible inside a function. However, you can make them accessible by declare them as "global" inside a function. Here is a PHP script on declaring "global" variables:
<?php ?> $intRate = 5.5; function myAccount() { global $intRate; print("Defined inside the function? ". isset($intRate)."\n"); } myAccount(); print("Defined outside the function? ". isset($intRate)."\n"); ?>
This script will print:
Defined inside the function? 1 Defined outside the function? 1
2007-04-24, 4622👍, 0💬
Popular Posts:
Can you explain different software development life cycles -part II? Water Fall Model This is the ol...
What is CodeDom? “CodeDom” is an object model which represents actually a source code. It is designe...
.NET INTERVIEW QUESTIONS - What are Daemon threads and how can a thread be created as Daemon? Daemon...
How To Join a List of Keys with a List of Values into an Array? - PHP Script Tips - PHP Built-in Fun...
What is the version information in XML? “version” tag shows which version of XML is used.