In this tutorial we will learn about Data Types in PHP. PHP support various data types like strings, numeric types complex data types like array and objects. There are total eight data types available in PHP that are integer, float, string, boolean, array, object, resource and NULL. These data types are use to define what kind of data a variable can store.
Now we will learn every data type in detail with the help of examples.
Integer: In integer data type we can store integers mean decimal numbers, octal numbers, and hexadecimal numbers. These number may be signed or unsigned depends on requirements means like 10 or +10;
"; $num2 = -123; // signed integer echo $num2; echo "
"; $num3 = 0x1A; // hexadecimal number echo $num3; echo "
"; $num4 = 0123; // octal number echo $num4; ?>
"; $str2 = "Owlbuddy"; echo $str2; echo "
$name; } } // Create object from class $car1 = new car; ?>