Home
PHP
Chart
Class
Components
Cookie Session
Data Structure
Data Type
Date
Design Patterns
Development
DNS
Email
File Directory
Form
Functions
Graphics Image
HTML
Language Basics
Login Authentication
Math
MySQL Database
Network
Operator
PDF
Reflection
Statement
String
Utility Function
Web Services SOAP WSDL
XML
Menu
Defining Variable Scope : Variable Scope « Language Basics « PHP
PHP
Language Basics
Variable Scope
Defining Variable Scope
<?php $a = 7; function test() { $a = 20; } test(); echo
"\$a = $a\n"
; ?>
Related examples in the same category
1.
Variable scope: function
2.
Use variable defined outside function
3.
Scope of a Variable
4.
Variable Scope: A Variable Declared Within a Function Is Unavailable Outside the Function
5.
Variables Defined Outside Functions Are Inaccessible from Within a Function by Default
6.
More Working with Variable Scope
7.
local variables
8.
Variable Scope
9.
Variable Scope in Functions
10.
Variable Scope: A Variable Declared Within a Function Is Unavailable Outside the Function