Everything your PHP does.
Now in JavaScript.

Pext doesn't cut corners. Here's a precise audit of every PHP feature and pattern we support — and what's still on the roadmap.

01
01

Language Constructs

Core PHP syntax faithfully reproduced — from variables and types to closures, generators, and attributes.

10 supported 5 partial 1 not supported
  • Inline HTML mixed with PHP is not supported — files are treated as pure PHP code
  • The transpiler assumes each file is a self-contained PHP script
  • Comments (//, #, /* */, /** */) are parsed but not carried over to JS output
  • Type declarations are dropped at transpile time — types on parameters, properties, and return values are not carried over to JS; some information is preserved in reflection data
  • null is fully supported
  • Booleans are fully supported
  • int and float are both mapped to JS number — no distinction at runtime
  • Strings are fully supported
  • Arrays and objects are fully supported
  • Resources and callables are fully supported
  • self, static, parent type references are fully supported
  • Iterables are fully supported PHP 7.1
  • Type juggling (loose comparisons and coercions) is fully supported
  • Standard variable declaration and assignment
  • Pass-by-reference (&$var) fully supported
  • Variable variables ($$name) supported
  • global and static variable keywords
  • Proper scope isolation between functions and global scope
  • isset(), unset(), empty(), define() language constructs fully supported
  • define() and const declarations
  • Class constants and interface constants
  • Magic constants: __FILE__, __LINE__, __CLASS__, __FUNCTION__, __METHOD__, __NAMESPACE__, __DIR__
  • Arithmetic: +, -, *, /, %, ** (exponentiation)
  • Comparison: ==, ===, !=, !==, <, >, <=, >=, <=> (spaceship)
  • Logical: &&, ||, !, and, or, xor
  • Bitwise: &, |, ^, ~, <<, >>
  • String concatenation (.) and concatenation assignment (.=)
  • Increment/decrement: ++$a, $a++, --$a, $a--
  • Assignment: by reference (=&), arithmetic (+=, -=, *=, /=, %=, **=), bitwise (&=, |=, ^=, <<=, >>=), string (.=), and nested assignments
  • Null coalescing: ?? introduced in 7.0, ??= in 7.4; spread (...) introduced in 5.6 PHP 7.0
  • Not supported: execution operator (backtick), pipe operator (|>) In Progress
  • if / elseif / else and ternary (?:)
  • switch and match expressions (with strict comparison) PHP 8.0
  • for, foreach (with key-value unpacking), while, do-while
  • break and continue, including level argument (break 2)
  • return with and without values
  • File inclusion: include, include_once, require, require_once
  • Not supported: goto, declare
  • Named functions and methods
  • Closures with use() bindings (by value and by reference)
  • Arrow functions (fn() =>) and anonymous functions (function() {}) PHP 7.4
  • Variadic arguments (...$args)
  • Named arguments are preprocessed at transpile time into positional arguments — dynamic function invocation with named arguments is not supported PHP 8.0
  • Default parameter values and nullable parameters
  • First-class callable syntax PHP 8.1
  • Properties and class constants are supported
  • Property and method visibility (public, protected, private) is not enforced at runtime
  • Property hooks are not yet supported In Progress PHP 8.4
  • Autoloading is fully supported
  • Inheritance is fully supported
  • Scope resolution (::) is fully supported
  • Interfaces are partially supported: present in reflection data but their types are not enforced
  • Traits are fully supported
  • Anonymous classes are minimally supported PHP 7.0
  • Overloading is supported
  • Object iteration is supported
  • Magic methods: __get, __set, __construct, __destruct, __isset, __unset, __invoke, __toString are supported; others are partially supported
  • final keyword is dropped at transpile time
  • Late static binding is supported
  • Object references are supported; referencing object properties by reference is not fully supported In Progress
  • Cloning and comparing are minimally supported In Progress
  • Object serialization is minimally supported
  • Lazy objects are not supported PHP 8.4
  • Predefined interfaces and classes (Countable, Iterator, ArrayAccess, Stringable, etc.) are supported PHP 8.0
  • Namespaces are fully supported at runtime
  • Sub-namespaces with arbitrary depth are fully supported
  • Integration with dynamic features (dynamic class instantiation, function calls, etc.) is supported
  • Aliasing via use ... as ... is supported
  • Fallback to global scope for unqualified names is supported
  • try / catch (multi-catch with |) / finally PHP 8.0
  • Custom exception class hierarchies
  • set_error_handler and set_exception_handler
  • trigger_error and PHP error level constants
  • Throwable interface and Error base class PHP 7.0
  • Predefined exceptions (RuntimeException, InvalidArgumentException, LogicException, etc.) are supported
  • Passing by reference (&$var in function signatures) is supported
  • Copy on write semantics are supported
  • Returning references from functions is not yet supported In Progress
  • Unsetting references (unset($ref)) is not yet supported In Progress
  • yield by value and by reference
  • yield from and generator delegation PHP 7.0
  • Generator::send() and Generator::throw() In Progress
  • Return values from generators (Generator::getReturn()) In Progress PHP 7.0
  • #[Attribute] declaration syntax PHP 8.0
  • Attribute targeting: class, method, property, parameter, function, constant PHP 8.0
  • Runtime access via ReflectionAttribute PHP 8.0
  • Repeatable attributes PHP 8.0
  • Predefined attributes: #[SensitiveParameter] (8.2), #[Override] and #[Deprecated] (8.3) PHP 8.2
  • Trait composition (use Trait)
  • Abstract trait methods
  • Trait constants PHP 8.2
  • Basic (unit) enums PHP 8.1
  • Backed enums (string and int) PHP 8.1
  • Enum methods and constants PHP 8.1
  • Runtime constants: PHP_INT_MAX, PHP_INT_MIN, PHP_FLOAT_MAX, PHP_EOL, PHP_MAJOR_VERSION, PHP_VERSION, and more
  • true, false, null literals
  • Web server superglobals not available: $_SERVER, $_GET, $_POST, $_FILES, $_SESSION, $_COOKIE In Progress
  • Pext does not currently embed a web server runtime
  • PHP 8.1 Fibers are not currently supported
  • Lightweight concurrency primitives are not yet part of the Pext runtime
02
02

Standard Library

PHP built-in functions and classes reimplemented natively in the Pext runtime.

11 supported 5 partial
  • array_map, array_filter, array_reduce, array_walk
  • array_merge, array_slice, array_splice, array_chunk, array_combine
  • Sorting: sort, rsort, usort, ksort, uasort, array_multisort
  • array_key_exists, in_array, array_search, array_unique, array_flip
  • array_push, array_pop, array_shift, array_unshift
  • compact and extract
  • DateTime and DateTimeImmutable classes
  • DateInterval and DatePeriod
  • date, strtotime, mktime, time, microtime, checkdate
  • date_create, date_format, date_diff, date_add, date_sub
  • DOMDocument, DOMElement, DOMAttr, DOMText nodes supported
  • DOMXPath queries supported
  • createElement, appendChild, getElementById, getElementsByTagName
  • loadHTML, loadXML, saveHTML, saveXML
  • Some advanced DOM manipulation methods are in progress In Progress
  • error_reporting, set_error_handler, restore_error_handler
  • set_exception_handler, restore_exception_handler
  • trigger_error, user_error
  • error_get_last, error_clear_last
  • FileHandlingError
  • FileInfo
  • FileObject
  • file_get_contents, file_put_contents, file_exists, file
  • mkdir, rmdir, rename, copy, unlink, symlink
  • opendir, readdir, closedir, scandir, glob
  • is_file, is_dir, is_readable, is_writable, filesize, filemtime
  • realpath, dirname, basename, pathinfo
  • PHP_VERSION, PHP_MAJOR_VERSION, PHP_OS, PHP_INT_MAX, PHP_EOL, and similar constants
  • phpversion(), php_uname(), ini_get(), ini_set() supported
  • phpinfo() and web-server-related info functions not available
  • Iterator and IteratorAggregate interfaces
  • ArrayIterator, ArrayObject
  • SplStack, SplQueue, SplHeap, SplMinHeap, SplMaxHeap
  • SplDoublyLinkedList, SplFixedArray
  • RecursiveIterator and RecursiveIteratorIterator
  • json_encode with all flags (JSON_PRETTY_PRINT, JSON_UNESCAPED_UNICODE, JSON_THROW_ON_ERROR, etc.)
  • json_decode with associative array and object modes
  • json_last_error, json_last_error_msg
  • json_validate PHP 8.3
  • libxml_use_internal_errors, libxml_get_errors, libxml_clear_errors
  • LIBXML_* constants supported
  • Some advanced libxml options are in progress In Progress
  • abs, ceil, floor, round, max, min, pow, sqrt, fmod, intdiv
  • Trigonometry: sin, cos, tan, asin, acos, atan, atan2, deg2rad, rad2deg
  • log, log10, log2, exp
  • rand, mt_rand, random_int, random_bytes
  • bcmath: bcadd, bcsub, bcmul, bcdiv, bcmod, bcpow, bccomp, bcscale
  • M_PI, M_E, INF, NAN constants
  • ob_start, ob_end_clean, ob_end_flush, ob_get_contents, ob_get_clean
  • ob_flush, ob_get_level, ob_get_length
  • echo, print, print_r, var_dump, var_export
  • Output buffering tied to non-web runtime — some behaviors differ from PHP's web SAPI In Progress
  • preg_match, preg_match_all, preg_replace, preg_replace_callback, preg_split
  • Named capture groups, backreferences, lookahead/lookbehind
  • PREG_OFFSET_CAPTURE, PREG_SET_ORDER, PREG_PATTERN_ORDER flags
  • preg_quote, preg_last_error
  • ReflectionClass: name, methods, properties, constants, interfaces, traits
  • ReflectionMethod, ReflectionProperty, ReflectionParameter
  • ReflectionFunction, ReflectionExtension
  • ReflectionAttribute for reading #[Attributes] at runtime PHP 8.0
  • Some advanced reflection capabilities (closures, generators) are in progress In Progress
  • str_replace, str_contains, str_starts_with, str_ends_with, substr, strpos, strlen
  • explode, implode, trim, ltrim, rtrim, str_pad, str_repeat, str_split
  • strtolower, strtoupper, ucfirst, ucwords, lcfirst
  • sprintf, printf, number_format, money_format
  • Multibyte string functions (mb_*)
  • str_contains, str_starts_with, str_ends_with PHP 8.0
  • isset, empty, unset, is_null, is_bool, is_int, is_float, is_string, is_array, is_object
  • gettype, settype, get_debug_type PHP 8.0
  • intval, floatval, strval, boolval
  • var_dump, var_export, print_r, serialize, unserialize
  • is_numeric, is_callable, is_iterable, is_countable

Ready to break free from PHP?

Book a personalized demo and see how Pext can transform your codebase from legacy PHP to modern JavaScript, without rewriting a single line by hand.