PHP 8.3 Features in PHP

From the PHP cheat sheet ยท PHP 8 Features ยท verified Jul 2026

PHP 8.3 Features

Typed class constants, #[\Override], json_validate, dynamic class constants

php
// Typed class constants (PHP 8.3)
class Config {
    const string VERSION = '1.0.0';
    const int MAX_USERS = 100;
}

// #[\Override] attribute (PHP 8.3)
class Base {
    public function greet(): string {
        return 'Hello';
    }
}

class Child extends Base {
    #[\Override]
    public function greet(): string {
        return 'Hi';
    }
}

// json_validate() (PHP 8.3)
if (json_validate($jsonString)) {
    $data = json_decode($jsonString, true);
}

// Dynamic class constants (PHP 8.3)
class Status {
    const ACTIVE = 'active';
    const INACTIVE = 'inactive';
}
$name = 'ACTIVE';
echo Status::{$name};  // 'active'
๐Ÿ’ก Typed class constants prevent subclasses from drifting on type
๐Ÿ“Œ #[\Override] catches typos when refactoring parent classes
โšก json_validate is cheaper than json_decode just to test validity
๐ŸŸข Dynamic class constants mirror dynamic property access
php8.3featuresmodern

Continue with PHP

Save the full cheat sheet or work through every related task.

More PHP tasks

Back to the full PHP cheat sheet