What are the data types in PHP?
What are data types?
Data types are various types of data that a variable can store. PHP supports eight data types. In this shot, we'll look at a few of them.
- String: A string is a text written inside quotation marks.
Example
<?php$text = "Educative";var_dump($text);
- Integer: Positive and negative whole numbers.
Example
<?php$number = 12321123;var_dump($number);
- Float: Positive and negative numbers with a decimal point.
Example
<?php $float = 123.123;var_dump($float);
- Boolean: True or false values.
Example
<?php$x = true;$y = false;var_dump($x);
- Array: Collection of similar data.
Example
<?php$cities = array("Owerri","Telaviv","Washington");var_dump($cities);