Data Types in PHP Programming Language. The following code shows various data types in PHP Programming.
PHP supported data types:
Code:
$str = "Hello world!";
var_dump($str);
echo '<br/> String:';
$str = 'Hello world!';
var_dump($str);
echo '<br/> Integer:';
$int = 1234;
var_dump($int);
echo '<br/> Float or Double: ';
$d = 123.34;
var_dump($d);
echo '<br/> Array: ';
$arr = [1, 5, 2, 6];
var_dump($arr);
echo '<br/> Boolean: ';
$b = true;
var_dump($b);
Output:
string(12) "Hello world!"
String:string(12) "Hello world!"
Integer:int(1234)
Float or Double: float(123.34)
Array: array(4) { [0]=> int(1) [1]=> int(5) [2]=> int(2) [3]=> int(6) }
Boolean: bool(true)