Doc #74064 [NEW]: è¿ä¸ªä¹è½é???
| From: | bhg at live dot it | Date: | Thu, 09 Feb 2017 01:27:27 +0000 |
| Subject: | Doc #74064 [NEW]: è¿ä¸ªä¹è½é??? | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-14427@lists.php.net to get a copy of this message | ||
From: bhg at live dot it
Operating system: Windows
PHP version: 7.1.1
Package: Translation problem
Bug Type: Documentation Problem
Bug description:è¿ä¸ªä¹è½é???
Description:
------------
---
From manual page: http://php.net/manual/zh/migration71.new-features.php
---
Test script:
---------------
$data = [
['id' => 1, 'name' => 'Tom'],
['id' => 2, 'name' => 'Fred'],
];
while (['id' => $id, 'name' => $name] = $data) {
echo $id, $name;
// logic here with $id and $name
}
Expected result:
----------------
$data = [
["id" => 1, "name" => 'Tom'],
["id" => 2, "name" => 'Fred'],
];
// list() style
list("id" => $id1, "name" => $name1) = $data[0];
// [] style
["id" => $id1, "name" => $name1] = $data[0];
// list() style
foreach ($data as list("id" => $id, "name" => $name)) {
// logic here with $id and $name
}
// [] style
foreach ($data as ["id" => $id, "name" => $name]) {
// logic here with $id and $name
}
Actual result:
--------------
$data = [
['id' => 1, 'name' => 'Tom'],
['id' => 2, 'name' => 'Fred'],
];
while (['id' => $id, 'name' => $name] = $data) {
echo $id, $name;
// logic here with $id and $name
}
--
Edit bug report at https://bugs.php.net/bug.php?id=74064&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74064&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74064&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74064&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74064&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74064&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74064&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74064&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74064&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74064&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74064&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74064&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74064&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74064&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74064&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74064&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74064&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74064&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74064&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74064&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74064&r=mysqlcfg