Skip to content

Commit

Permalink
Mover um parágrafo e ws sync.
Browse files Browse the repository at this point in the history
  • Loading branch information
André L F S Bacci committed Jul 4, 2023
1 parent 8341453 commit b4e125f
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions reference/array/functions/list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<entry>7.1.0</entry>
<entry>
Agora é possível especificar chaves em <function>list</function>. Isso
habilita desestruturar os arrays com chaves não-integer e não-sequencial.
habilita desestruturar os arrays com chaves não-integer e não-sequencial.
</entry>
</row>
</tbody>
Expand All @@ -106,7 +106,7 @@ echo "$bebida é $cor e $substancia o faz especial.\n";
list($bebida, , $substancia) = $info;
echo "$bebida tem $substancia.\n";
// Ou ignoramos os primeiros valores para conseguir apenas o último
// Ou ignoramos os primeiros valores para conseguir apenas o último
list( , , $substancia) = $info;
echo "I need $substancia!\n";
Expand All @@ -120,7 +120,7 @@ var_dump($bar); // NULL
</para>
<para>
<example>
<title>Exemplo da <function>list</function></title>
<title>Exemplo da <function>list</function></title>
<programlisting role="php">
<![CDATA[
<?php
Expand All @@ -136,10 +136,6 @@ while (list($id, $nome) = $resultado->fetch(PDO::FETCH_NUM)) {
<para>
<example>
<title><function>list</function> e ordem das definições de índice </title>
<simpara>
A ordem em que são definidos os índices do array para
ser consumido pela <function>list</function> é irrelevante.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
Expand All @@ -163,22 +159,25 @@ int(3)
<para>
<example>
<title>Usando <function>list</function> com índices de array</title>
<simpara>
A ordem em que são definidos os índices do array para
ser consumido pela <function>list</function> é irrelevante.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
$foo = array(2 => 'a', 'foo' => 'b', 0 => 'c');
$foo[1] = 'd';
list($x, $y, $z) = $foo;
var_dump($foo, $x, $y, $z);
]]>
</programlisting>
<para>
O retorno desse script é o seguinte (note a ordem dos elementos em
comparação com o array original):
</para>
<screen>
<![CDATA[
<para>
O retorno desse script é o seguinte (note a ordem dos elementos em
comparação com o array original):
</para>
<screen>
<![CDATA[
array(4) {
[2]=>
string(1) "a"
Expand Down Expand Up @@ -227,10 +226,10 @@ id: 1, name: Mario
id: 2, name: Frederico
2, 4
]]>
</screen>
</example>
</para>
]]>
</screen>
</example>
</para>
</refsect1>

<refsect1 role="seealso">
Expand Down

0 comments on commit b4e125f

Please sign in to comment.