Data Type

PHP is loosely typed, which means it calculates data types as data is assigned to each variable.

Standard Data Types

Type Description
Integer A whole number
Double A floating-point number
String A collection of characters Boolean Array One of the special values true or false.
Array Arrays are named and indexed collections of other values.
Objects             Objects are instances of programmer-defined classes,which can kinds of
values and functions that are specific to the class.


Special Data Types

Type Description
Resource Reference to a third-party resource (e.g - a database)
Null An uninitialized Variable.

Constant

  • Constants have global scope, so they are accessible.

  • After they have been defined ,We can use everywhere in your scripts as well as inside functions.

Example :
<?php
define("Greeting","TechKnow Heights"); 
echo constant("Greeting "); 
?>

Output

  • Echo : The simplest use of echo is to print a string as argument.

  • Example :
    echo "it is example to print a string .";
    Or
    echo("it is example to print the string .");

  • Print :Print can accept only one argument and returns a value, which represents whether the print statement succeeded.