PHP Veriables

  • Variable is place holder to store the values
  • PHP variable must specify with $key word
  • $variable=value
  • A variable starts with the $ sign, followed by the name of the variable
  • Variable name should not start with number
  • A variable name must start with a letter or the underscore character
  • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  • Variable names are case-sensitive ($age and $AGE are two different variables)
  • Normal variables will override each other but constant variable will never support variable overriding concept
  • Scope of Variables


Local Variables: Function variables are called local variables it will available only within the function

Argument variables: These are also available within the function only


Global variables: The scope of the global variable is entire class webpage if you want to use global variable inside a function must declare variable with global key word

No comments:

Post a Comment