🟢 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

TypeExample
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() or gettype().

PHP Data Types

PHP कई data types support करती है। किसी value का type var_dump() या gettype() से check कर सकते हैं।

Common Types

TypeExample
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 करें।
← Back to PHP Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।