0Pricing
PHP Academy · Lesson

PHP Data Types Overview

Explore strings, integers, floats, booleans, and NULL in PHP.

PHP's Core Data Types

PHP supports four scalar types and several compound/special types:

  • Scalar: string, int, float, bool
  • Compound: array, object
  • Special: NULL, resource

PHP automatically chooses the type based on context — this is called type juggling.

Strings

Strings store text. Use single or double quotes:

<?php
$single = 'Hello World';     // single — no variable parsing
$name   = 'PHP';
$double = "Hello $name";     // double — variables are interpolated

echo $double; // Hello PHP
echo strlen($single); // 11

All lessons in this course

  1. Declaring Variables in PHP
  2. PHP Data Types Overview
  3. Echo and Print Output
  4. Type Juggling and Type Casting
← Back to PHP Academy