PHP Training for Beginners - Creating and using variables in PHP code

Опубликовано: 17 Октябрь 2024
на канале: baghul
699
1

https://www.learningcomputer.com/what...


In this PHP tutorial for beginners, we go over creating and using variables in PHP. We show how to define and then assign a php variable. Here are the vital points:
-A PHP variable starts with the $ sign, followed by the name of the variable
-PHP variable name must start with a letter or the underscore character and not a number
-A PHP code variable name can only contain alpha-numeric characters and underscores
-Variable in PHP names are case-sensitive ($age and $AGE are two different variables)

You can use either this $_ or $firstname. Camel casing is a good option to use. We can try single quote vs double quotes, end with semi colon

Variable in PHP can have the scope:
-local
-global
-static

Visit our other sites:
https://www.learningcomputer.com
https://datatechnologyllc.com
https://sqlserver2014tutorial.com/