Learn More about PHP Variablesby Coding Tag Codingtag
The role of PHP Variables is to store the required data that can be utilized later in the program. This blog will let you know about the basics of PHP Variables along with some rules that you need to keep in mind while working with PHP Variables.
If you are a novice and want PHP Interview Questions, you can search it online.
As the name defines, Variables are those that are commonly be written as the values or the symbols. The PHP Variables are used for managing and keeping the data store that can be used afterward in the program. The variable in PHP can be stored for memory addresses, characters, character string, numeric values and so on. These stored data can be later used anywhere while writing a program.
Before writing any program or dealing with PHP variables, there are certain rules or facts available that are mandatory to follow for the execution of the same.
· The PHP
Variables that are declared should be written with a dollar sign following the
name of the variable.
· The name for the variables can be written in a short or descriptive manner.
· There must be alphanumeric characters indulged in the name of a variable.
· The PHP operator “equal to (=)” is an assignment operator, required for variable assignments. The name of the variable can be placed at the left top of the equal assignment operator.
· The PHP Variable names must not begin with any number; rather it can be started with underscore or letter.
· In PHP, there is no need to declare the data types. PHP identifies the data by itself. This happens because PHP is considered as a loosely typed language. Likewise, it works in the case of conversion.
Reasons for not starting a variable with a number
A variable cannot be started with a number because for every programming language, this is the set standard. If we start with an underscore or a letter, it becomes convenient for a user to identify if a token is starting with a numeric value.
Even if you think this is not your cup of tea, and you are looking for a career similar to this, you can refer to HTML Interview Questions.
Hey, I am John Davis and writing this article on PHP Variable to help you understand the same. If you like my article, please comment in the comment section.
Created on Sep 11th 2019 01:43. Viewed 239 times.