PHP 5 Variables

Hello Guys In This Post We will Learn about PHP 5 Variables ,  We will leran about PHP 5 Variables with help of php and mysql, do you want to learn this if yes then let's get started.

What is PHP 5 Variables?

Php 5 variable contains information about data and denoted by dollar Sign ($). if you want to make a variable then you need to write some text before you need to add $ sign like following code

Creating or  Define a PHP Variables

<?php
$myvariable= "my First variable";
?>

Output PHP Variables

<?php
$myvariable= "my First variable";
echo $myvariable;
?>

  • upon the given $myvariable is variable.
  • echo $myvariable; for Show information on the web page.
  • You can copy and paste upon the given following code on notepad++ or any Editor, then run page.

Output

my First variable

Add Two PHP Variables 

<?php
$mytext= "We are reading the PHP with";

$webname= "www.skillneverend.com";
echo $mytext." ".$webname;
?>

Output

We are reading the PHP with www.skillneverend.com

Second Example : 

 

<?php
$theory_number=300 ;

$practicle_nubmer= 75;
echo $theory_number+ $practicle_nubmer;
?>

Output

375

Conbine PHP Variables and String text

<?php
$webname= "www.skillneverend.com";
echo "We are reading the PHP with ".$webname;
?>

Output

We are reading the PHP with www.skillneverend.com