WordPress Playground + PHP next

Preview PHP 8.6 in your browser

These examples run on Playground's PHP next WebAssembly build. Click Run to verify the output in the same browser tab, without installing PHP locally.

PHP 8.6 is still under development. This page focuses on features that are already available in the current php-src development build used by Playground.

clamp() keeps values inside a range

Use clamp() when user input, percentages, ratings, or layout values must stay between a lower and upper bound.

SortDirection makes sort APIs type-safe

PHP 8.6 adds a global SortDirection unit enum with Ascending and Descending cases.

Reflection can ask whether a property is readable or writable

ReflectionProperty::isReadable() and isWritable() account for readonly and asymmetric visibility rules that isPublic() cannot express.

Enums can customize var_dump()

Enums may now implement __debugInfo(), so debugging output can show the domain-specific details you care about.

trim() now removes form feed by default

PHP 8.6 treats \f like other default whitespace in trim(), ltrim(), rtrim(), and chop().

References