cURL ¶ : CURLStringFile, FileInfo ¶ : finfo, FTP ¶ : FTP\Connection, IMAP ¶ : IMAP\Connection, Intl ¶ : IntlDatePatternGenerator, PSpell ¶ : PSpell\Config · PSpell\Dictionary, Reflection ¶ : ReflectionFiber
Core ¶ : Deprecated · RequestParseBodyException, BCMath ¶ : BcMath\Number, DBA ¶ : Dba\Connection, ODBC ¶ : Odbc\Connection · Odbc\Result, PCNTL ¶ : Pcntl\QosClass (macOS only), PDO_DBLIB ¶ : Pdo\DbLib, PDO_FIREBIRD ¶ : Pdo\Firebird, PDO_MYSQL ¶ : Pdo\Mysql, PDO_ODBC ¶ : Pdo\Odbc, PDO_PGSQL ¶ : Pdo\Pgsql, PDO_SQLITE ¶ : Pdo\Sqlite, Reflection ¶ : ReflectionConstant, SOAP ¶ : Soap\Url · Soap\Sdl, Standard ¶ : RoundingMode · StreamBucket
Перехід від PHP 7.3.x до PHP 7.4.x ; New Features · New Classes and Interfaces · New Functions · New Global Constants · Backward Incompatible Changes · Deprecated Features · Removed Extensions · Other Changes · Windows Support
<?php · class SomeClass {} · interface SomeInterface {} · trait SomeTrait {} · var_dump(new class(10) extends SomeClass implements SomeInterface { · private $num; public function __construct($num) · { · $this->num = $num; use SomeTrait; );
PHP Core ¶ ; Readonly Amendments ¶ ; Typed Class Constants ¶ ; Closures created from magic methods ¶ ; The final modifier with a method from a trait ¶ ; Override Attribute ¶ ; Fetch class constant dynamically syntax ¶ ; Static variable Initializers ¶ ; Fallback value syntax for ini variables ¶
<?php · class SomeClass {} · interface SomeInterface {} · trait SomeTrait {} · var_dump(new class(10) extends SomeClass implements SomeInterface { · private $num; public function __construct($num) · { · $this->num = $num; use SomeTrait; );
PHP Core ¶ ; Integer Octal Literal Prefix ¶ ; Array Unpacking with String Keys ¶ ; Named Argument After Argument Unpacking ¶ ; full-path Key for File Uploads ¶ ; Enumerations ¶ ; Fibers ¶ ; First Class Callable Syntax ¶ ; Never type ¶ ; Readonly properties ¶ ; Final class constants ¶
PHP 8.2 is a major update of the PHP language. Readonly classes, null, false, and true as stand-alone types, deprecated dynamic properties, performance improvements and more
Example #1 Defining and using a constant ; <?php · class MyClass · { const CONSTANT = 'constant value'; function showConstant() { · echo self::CONSTANT . "\n"; } } echo MyClass::CONSTANT . "\n"; $classname = "MyClass"; echo $classname::CONSTANT . "\n"; $class = new MyClass(); $class->showConstant(); echo $class::CONSTANT."\n"; ?>
Example #1 Simple Class definition ; <?php · class SimpleClass · { · // property declaration · public $var = 'a default value'; // method declaration · public function displayVar() { · echo $this->var; } } · ?>