Part 1 · Fundamentals / Readonly bindings
Lesson 3 of 8

Readonly bindings

Prefix a declaration with readonly to create a binding that never changes after initialization:

env.ppphp
readonly string $env = "prod";

Reassignment is a compile error, and the editor tries exactly that. Press Check to see the compiler reject it, then delete the reassignment line:

env.ppphp
$env = "dev";   // delete this line

Check again, then press Run to see the binding printed.