Use variable defined outside function : Variable Scope : Language Basics PHP Source Code
Ajax
Ajax Examples
Ajax Tutorials
Scripts and Programs
Javascript
Javascript Examples Tutorials
DHTML Tutorials
Javascript References
Scripts and Programs
HTML
HTML Tutorials
HTML References
HTML DOM 0 References
HTML DOM 2 References
CSS
CSS Tutorials
CSS References
PHP
PHP Source Code
PHP References
Scripts and Programs
C#
C# Source Code
C# Examples
PHP Source Code
»
Language Basics
»
Variable Scope
»
Use variable defined outside function
<?php
$ilike =
"Rock"
;
function
music
(){
echo
"I love listening to $ilike music!"
,
"n"
;
}
music
()
;
?>
HTML code for linking to this page:
Related in same category :
Variable scope
Scope of a Variable
Variable Scope
Variables Defined Outside Functions Are Inaccessible from Within a Function by Default
PHP Function Reference -> Users Code Examples / Notes - > Variable Scope:
Using Variables
Variable parsing
Pseudo-types and variables used in this documentation
Variables
Predefined variables
Variable scope
Using static variables
References with global and static variables
Variable variables
Variables from outside PHP
IMAGE SUBMIT variable names
Dots in incoming variable names
Determining variable types
Variable-length argument lists
Variable functions
Scope Resolution Operator (::)
Scope Resolution Operator (::)
mb_convert_variables
define_syslog_variables
Variable Handling Functions
import_request_variables
Variable substitution in strings
Handling of global variables
Variable and Type Related Extensions
Predefined Variables
Server variables: $_SERVER
Environment variables: $_ENV
HTTP GET variables: $_GET
HTTP POST variables: $_POST
HTTP File upload variables: $_FILES
Request variables: $_REQUEST
Session variables: $_SESSION
Global variables: $GLOBALS
PHP Source Code
Language Basics
»
Variable Scope
Arithmetic Operators
Assign Operator
Binary Number
Bitwise Operators
Boolean
Break
Char
Comments
Constant
Continue
Data Type Convert
Data Type
Define Constant
Do While
Double
Equality Operators
Exit
For Each
For
Global
GLOBALS
Hexadecimal Number
If
Include
Integer
Logic Operators
Modulus
Octal Number
Operator Precedence
Php Tag
PNG
Polygon
Postfix Prefix Operators
Pre Defined Constant
Reference
Relational Operators
Shorthand Operators
Static
Switch
Trinary Operator
Variable Cast
Variable Scope
Variable Set Unset
Variable Type
While
Chart
Class
COM and .Net (Windows)
Components
Cookie Session
Data Structure
Databases
Design Patterns
Development
Email
File Directory
Form
Functions
Graphics Image
HTML
Language Basics
Login Authentication
Math
MySQL Database
Network
String
Web Services SOAP WSDL
XML