rfc:list_default_value
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:list_default_value [2015/11/09 13:53] – reeze | rfc:list_default_value [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 9: | Line 9: | ||
We could destruct variables from an array with [[http:// | We could destruct variables from an array with [[http:// | ||
- | For the similar | + | For the similar |
Some clever users figured out some workaround like this [[http:// | Some clever users figured out some workaround like this [[http:// | ||
Line 15: | Line 15: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | Support new syntax to set default | + | Support new syntax to set default |
<code php> | <code php> | ||
Line 22: | Line 22: | ||
list($a, $b=' | list($a, $b=' | ||
- | // comparation | + | // comparation |
- | list($a, list($b=1, $c=2) = $arr; | + | list($a, list($b=1, $c=2)) = $arr; |
// or we need to check it ourself | // or we need to check it ourself | ||
if (!isset($arr[1][0])) { | if (!isset($arr[1][0])) { | ||
Line 32: | Line 32: | ||
} | } | ||
- | $list($a, list($b, $c)) = $arr; | + | list($a, list($b, $c)) = $arr; |
Line 51: | Line 51: | ||
<code php> | <code php> | ||
- | list($a, $b='deafult') = $arr; | + | list($a, $b='default') = $arr; |
// equals | // equals |
rfc/list_default_value.1447077218.txt.gz · Last modified: 2017/09/22 13:28 (external edit)