Doc #75901 [Opn->Asn]: (Chinese,zh)Example Diff with Other language, And Error
| From: | jhdxr@php.net | Date: | Thu, 01 Feb 2018 15:07:22 +0000 |
| Subject: | Doc #75901 [Opn->Asn]: (Chinese,zh)Example Diff with Other language, And Error | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15400@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75901&edit=1
ID: 75901
Updated by: jhdxr@php.net
Reported by: zhangshulin2008 at live dot cn
Summary: (Chinese,zh)Example Diff with Other language, And
Error
-Status: Open
+Status: Assigned
Type: Documentation Problem
Package: Translation problem
Operating System: All
PHP Version: 7.2Git-2018-02-01 (snap)
-Assigned To:
+Assigned To: jhdxr
Block user comment: N
Private report: N
New Comment:
Looks like the Chinese version is out-of-date, I'll update it later.
Previous Comments:
------------------------------------------------------------------------
[2018-02-01 03:36:24] zhangshulin2008 at live dot cn
Description:
------------
Documentation "New Features in 7.1" translation for Chinese:
No.3 Symmetric array destructuring
http://php.net/manual/zh/migration71.new-features.php
In Chinese:
Zh:
çæ°ç»è¯æ³ï¼[]ï¼ç°å¨å¯ä»¥ç¨äºå°æ°ç»çå¼èµç»ä¸äºåéï¼å
æ¬å¨foreachä¸ï¼ã
è¿ç§æ¹å¼ä½¿ä»æ°ç»ä¸æåå¼å徿´ä¸ºå®¹æã
<?php
$data = [
['id' => 1, 'name' => 'Tom'],
['id' => 2, 'name' => 'Fred'],
];
while (['id' => $id, 'name' => $name] = $data) {
// logic here with $id and $name
}
http://php.net/manual/en/migration71.new-features.php
In Other:
En:
Symmetric array destructuring ¶
The shorthand array syntax ([]) may now be used to destructure arrays for assignments (including
within foreach), as an alternative to the existing list() syntax, which is still supported.
<?php
$data = [
[1, 'Tom'],
[2, 'Fred'],
];
// list() style
list($id1, $name1) = $data[0];
// [] style
[$id1, $name1] = $data[0];
// list() style
foreach ($data as list($id, $name)) {
// logic here with $id and $name
}
// [] style
foreach ($data as [$id, $name]) {
// logic here with $id and $name
}
JA:
é
åã®çç¸®æ§æ ([]) ã使ã£ã¦ã
代å
¥ç¨ã«é
åã®å¤ãåãåºããããã«ãªãã¾ãã
(foreach ã§ã使ãã¾ã)ã ããã¯ãlist()
ã®ä»£æ¿ã¨ãã¦ä½¿ãã¾ã (list()
ãã¾ã 使ãã¾ã)ã
<?php
$data = [
[1, 'Tom'],
[2, 'Fred'],
];
// list() å½¢å¼
list($id1, $name1) = $data[0];
// [] å½¢å¼
[$id1, $name1] = $data[0];
// list() å½¢å¼
foreach ($data as list($id, $name)) {
// $id 㨠$name
ã使ãå¦çãããã«æ¸ãã¾ã
}
// [] å½¢å¼
foreach ($data as [$id, $name]) {
// $id 㨠$name
ã使ãå¦çãããã«æ¸ãã¾ã
}
Test script:
---------------
/
Expected result:
----------------
/
Actual result:
--------------
/
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75901&edit=1