🟢 Foundation · Lesson 05
Data Types in PHP
Data Types in PHP
PHP Data Types
PHP supports several data types. You can check any value's type with
var_dump() or gettype().Common Types
| Type | Example |
|---|---|
| String | $s = "Hello"; |
| Integer | $n = 100; |
| Float | $p = 9.99; |
| Boolean | $ok = true; |
| Array | $a = [1, 2, 3]; |
| NULL | $x = null; |
Checking Type
<?php
$age = 18;
var_dump($age); // int(18)
echo gettype($age); // integer
?>
Summary
- Types: string, integer, float, boolean, array, NULL.
- Check with
var_dump()orgettype().
PHP Data Types
PHP कई data types support करती है। किसी value का type
var_dump() या gettype() से check कर सकते हैं।Common Types
| Type | Example |
|---|---|
| String | $s = "Hello"; |
| Integer | $n = 100; |
| Float | $p = 9.99; |
| Boolean | $ok = true; |
| Array | $a = [1, 2, 3]; |
| NULL | $x = null; |
Type Check करना
<?php
$age = 18;
var_dump($age); // int(18)
echo gettype($age); // integer
?>
सारांश
- Types: string, integer, float, boolean, array, NULL।
var_dump()याgettype()से check करें।