search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

Home Backend Development PHP PHP7 new features manual Other language-level modifications

Other language-level modifications

1. Calling non-static methods statically in a non-compatible $this context will no longer be supported.

Calling non-static methods statically in a non-compatible $this context will no longer be supported. In this scenario, $this will not be defined, but the call can still be made, but there will be a warning:

class A {
  public function test() { var_dump($this); }
}

// Note: Does NOT extend A
class B {
  public function callNonStaticMethodOfA() { A::test(); }
}

(new B)->callNonStaticMethodOfA();

// Deprecated: Non-static method A::test() should not be called statically
// Notice: Undefined variable $this
NULL

Note that this situation applies to calls in incompatible contexts. In the above code example, class B and class A have no relationship, so $this is not defined when called.

But if class B inherits from class A, the call is legal.

2. The following reserved words cannot be used as class names, interface names and trait names.

bool
int
float
string
null
false
true
The following keywords have been reserved for future use and can currently be used without error, but are not recommended.
resourceobject
mixed
numeric

3. Yield syntax adjustment

When using the yield syntax structure in an expression, parentheses are no longer needed. It is now a right-associative operator with precedence between the "print" and "=>" operators. In some scenarios the behavior will be inconsistent with before.

echo yield -1;
echo (yield) - 1;  // 之前的语法解释行为
echo yield (-1);   // 现在的语法解释行为

yield $foo or die;
yield ($foo or die);  // 之前的语法解释行为
(yield $foo) or die;  // 现在的语法解释行为

Ambiguity can be avoided by using parentheses.

Note: Regarding yield, you can refer to this article by Brother Bird: http://www.laruence.com/2012/08/30/2738.html

4. Others Some adjustments.

Removed ASP format support and script syntax support: <% and <script language=php>

no longer support reference assignment to the result of new. (Thanks to Gazhikaba for sharing the translation)

Removed scope calls to non-static methods in non-compatible $this contexts. Reference materials: https://wiki.php.net/rfc/incompat_ctx. http://www.laruence.com/2012/06/14/2628.html

The ini file no longer supports # beginning For comments, use ;.

$HTTP_RAW_POST_DATA variable has been removed, use php://input instead. https://wiki.php.net/rfc/remove_alternative_php_tags
Hot AI Tools
Undress AI Tool
Undress AI Tool

Undress images for free

AI Clothes Remover
AI Clothes Remover

Online AI tool for removing clothes from photos.

Undresser.AI Undress
Undresser.AI Undress

AI-powered app for creating realistic nude photos

ArtGPT
ArtGPT

AI image generator for creative art from text prompts.

Stock Market GPT
Stock Market GPT

AI powered investment research for smarter decisions

Popular tool
Notepad++7.3.1
Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version
SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1
Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6
Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version
SublimeText3 Mac version

God-level code editing software (SublimeText3)