PHP Variable Naming Rules
by
While we have much freedom in choosing the names of our variables when writing a program, there are still always a set of rules we must abide by. The following are the PHP variable naming rules which I have taken from w3schools.
- A variable name must start with a letter or an underscore “_”
- A variable name can only contain alpha-numeric characters and underscores (a-Z, 0-9, and _ )
- A variable name should not contain spaces. If a variable name is more than one word, it should be separated with underscore ($my_string), or with capitalization ($myString)
Did You Enjoy this Post? Subscribe to Web Dev Notes. It's Free!
Leave a Reply