PHP Global Keyword
PHP Global Keyword:– Global keyword is used in php if we want to access a global variable inside a function.
PHP Global Keyword | Example
Let us take an exampmle to understand global keyword in php.
Example
<?php $x=10; function play(){ $y=20; echo $y; echo $x;// compile error echo "<br>"; echo "hey"; echo "<br>"; } play(); echo $x; echo $y;//compile error ?> |
Advertisements
Add Comment
📖 Read More
- 1. PHP While Loop
- 2. PHP For Loop
- 3. PHP Functions
- 4. PHP Array
- 5. PHP Sorting Array