Total Pageviews

Tuesday, November 1, 2011

variables in PHP


Some key points to remember when declaring variables in PHP
  • Remember to always put $ sign in front of variable names. That tells PHP that we're working with a variable.
  • In PHP a variable name must start with a letter or an underscore followed by combination of letters, number or underscores.
  • PHP variables are case sensitive, that means they could be either lower case or upper case or combination of both.
  • You don't have to worry about declaring the type of the variable. For example strings and integers are declared the same way.
  • It's good practice to initialize a variable i.e. assign it a value. Uninitialized variables in PHP have a value of either false, empty string or empty array.

No comments:

Post a Comment