In this blog I am going to to how to declare PHP variable output, PHP Variables Scope, PHP Global and Local Scope, PHP Global Keyword variable quotes and more.
Creating (Declaring) PHP Variables-
In PHP, a variable starts $ sign, this is mandatory for output or result
Variable always start with $ sign,
A variable name cannot start with a number.
A variable must start with a letter or underscore.
ex-
![](https://www.devopsschool.com/blog/wp-content/uploads/2020/06/declaring-variable.png)
PHP local scope:
Any variable declared inside a function is considered as in local scopte of function scope. It can be accessible only inside that function where it is declared.
![](https://www.devopsschool.com/blog/wp-content/uploads/2020/06/php-local-scope.png)
PHP global Scope
Any variable declared outside a function is considered as in the global scope. It can be accessed anywhere in the script.
![](https://www.devopsschool.com/blog/wp-content/uploads/2020/06/php-global-scope.png)
![loading](https://www.devopsschool.com/blog/wp-content/plugins/youtube-embed-plus/images/gallery-page-loader.gif)
![play](https://www.devopsschool.com/blog/wp-content/plugins/youtube-embed-plus/images/playhover.png)
PHP Fundamental Tutorials with Basic Demo by Chentan in 2020 – Part-1
![play](https://www.devopsschool.com/blog/wp-content/plugins/youtube-embed-plus/images/playhover.png)
PHP Fundamental Tutorials with Basic Demo by Chentan in 2020 – Part-2
![loading](https://www.devopsschool.com/blog/wp-content/plugins/youtube-embed-plus/images/gallery-page-loader.gif)
Latest posts by Rajesh Kumar (see all)
- How to remove sensitive warning from ms office powerpoint - July 14, 2024
- AIOps and DevOps: A Powerful Duo for Modern IT Operations - July 14, 2024
- Leveraging DevOps and AI Together: Benefits and Synergies - July 14, 2024