Lesson 12 of 3040%

(Progress persistence is disabled until Phase 9)

PHP
Beginner

Data Types and Type Checking

Learn about Data Types and Type Checking in PHP.

PHP is a powerful server-side language. In this lesson, we will cover Data Types and Type Checking.

Real code examples

<?php
$var = 42;
var_dump($var); // int(42)

$var = "Hello";
var_dump($var); // string(5) "Hello"

if (is_string($var)) {
    echo "It's a string!";
}
?>

Common mistakes

Make sure you include the <?php tag when writing PHP!

Try It Yourself

You can experiment with this in the Playground.

Lesson Progress

Take QuizBuild a PHP Project