🟢 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 करें।
💻 Live Code Editor
Is page ki language (PHP) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.