search
  • Sign In
  • Sign Up
Password reset successful

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

list()modification

Collection 105
Read 69607
update time 2016-09-11

1. list() no longer assigns values ​​in reverse order

list($array[], $array[], $array[]) = [1, 2, 3];
var_dump($array);

The above code will return an array: $array == [1, 2, 3] instead of before [3, 2, 1]

Note: Only the order of assignment changes, the assigned value is still the same as the original.

 list($a, $b, $c) = [1, 2, 3];
 // $a = 1; $b = 2; $c = 3;

The behavior is still the same as the original.

2. Empty list() assignment is no longer allowed.

list() = $a;
list(,,) = $a;
list($x, list(), $y) = $a;

The above codes will report an error when running.

3. list() no longer supports the string splitting function

$string = "xy";
list($x, $y) = $string;
The final result of this code is: $x == null and $y == null (there will be no prompt)

The result of PHP5 operation is: $x == "x" and $y == "y".

4. In addition, list() now also applies to array objects:

list($a, $b) = (object) new ArrayObject([0, 1]);
PHP7 results: $a == 0 and $b == 1.

PHP5 results: $a == null and $b == null.

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)