Course Content
Introduction
PHP is an object-oriented scripting programming language that allows web developers to create dynamic and interactive web pages. PHP stands for Hypertext Preprocessor (PHP).
0/14
Control Statement
A control statement is a statement that determines whether other statements will be executed.
0/7
PHP for Beginners
About Lesson

A Variable is a holder used to store both numeric and non-numeric data.

 

Rules for Variable declaration

  • In PHP, the variable starts with a dollar($) sign, succeeded by the name of the variable.
  • In PHP, a variable name must start with a letter or the underscore character.
  • In PHP, a variable name only contains alpha-numeric characters and underscores (A-Z,a-z, 0-9, and _).
  • A variable name must not contain space.

 

Assigning Values to Variables

<?php 
$name = "infovistar";
echo $name;
?>

Example (Addition of two numbers):

<?php
$a = 10;
$b = 15;
$c = $a + $b;
echo $c;
?>