Variables are used to store data, like string of text, numbers, etc. Variable values can change over the course of a script.You don’t need define a variable data type in php like a other language Example : int a = 2;  char b = WordPress Support;.

In php you will define a variable $a = “Hello Php”;  or $b = 10;

Example :

  • <?php
  • // Declaring variables
  • $txt = "Hello Php";
  • $number = 10;
  • 
    
  • // Displaying variables value
  • echo $txt;
  • <br>  // <br> is using for next line //
  • echo $number;
  • ?>

Output:

Hello Php

10

Thank you.


Leave a Reply