PHP VariablesVariables are containers to store data. We can add or change or delete data from the variable and use them in our script. Here are some basic rules to create variables.
Declaring variables in PHPVariable should start with $
Variable should contain numbers, alphabet and underscore
After $ we can't use number it must be alphabet or underscore
Variables are case sensitive
No need to declare variable type before using in PHP
Scope of VariableThe variables declared as global are available throughout the script and variables declared inside functions is know as local variable and are available inside the function only. Read more on scope of the variables in our PHP functions.
All variables are used within the page or within the script present in a page. As you are reading this page some variables are used to display the content of the page. These variables are lost as soon as this page execution is completed at server and downloaded to your browser. So how to pass the data or retain the data across the pages ?
Be the first to post comment on this article :