PhpStorm 2024.1 Help

PHP 7.3

PHP 7.3 brings new features, syntax additions, and bugfixes. For more information about migrating your code, refer to the Migrating from PHP 7.2.x to PHP 7.3.x guide.

Support reference assignment in list()

Starting with PHP 7.3, you can use assignments by reference inside list(). For earlier language versions, such usages are detected by the Language Level inspection in PhpStorm, and will lead to a Fatal error at runtime.

$array = [1, 2]; list($a, &$b) = $array;

Flexible Heredoc/Nowdoc Syntax

PHP 7.3 introduced a more flexible syntax for Heredoc and Nowdoc. For earlier language versions, using this syntax is detected by the Language Level inspection in PhpStorm, and will lead to a Parse error at runtime.

  • A new line is now not required after the closing tag:

    class foo { public $bar = <<<EOT bar EOT;}
  • The closing tag can be indented:

    class foo { public $bar = <<<EOT bar EOT; }

Support for literals as the first instanceof operand

PHP 7.3 allows using literals as the first operand of instanceof, in which case the evaluation result is always FALSE. For earlier language versions, such usages are detected by the Language Level inspection in PhpStorm, and will lead to a Fatal error at runtime.

if(!true instanceof SplBool){ echo "hello"; }

Support for a trailing comma in function calls

In PHP 7.3, you can use a trailing comma in function calls, which can be useful when calling variadic functions. In earlier language versions, such usages would result in a Parse error and will be detected by the Language Level inspection in PhpStorm.

unset( $foo, $bar, $baz, );
Last modified: 11 February 2024