Special welcome gift. Get 50% off your first courses with code “AS50”. Find out more!

HomeInterviewWhat are the rules for naming a PHP variable?
courses 5

What are the rules for naming a PHP variable?

The following two rules are needed to be followed while naming a PHP variable:

  • A variable must start with a dollar symbol, followed by the variable name. For example: $price=100; where price is a variable name.
  • Variable names must begin with a letter or underscore.
  • A variable name can consist of letters, numbers, or underscores. But you cannot use characters like + , – , % , & etc.
  • A PHP variable name cannot contain spaces.
  • PHP variables are case-sensitive. So $NAME and $name both are treated as different variables.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

Categories

ads sidebar 1

You May Also Like

Oracle has several modes for shutting down the database: In normal mode, the database is shut down by default. It...
Materialized views are items that contain condensed sets of data from base tables that have been summarized, clustered, or aggregated. They...
Every database in Oracle has a tablespace called SYSTEM, which is generated automatically when the database is created. It also...