svn: /phpdoc/pt_BR/trunk/language/control-structures/ break.xml continue.xml declare.xml elseif.xml foreach.xml include-once.xml return.xml switch.xml
[email protected] (André Luis Ferreira da Silva Bacci)
| Newsgroups | php.doc.pt-br |
|---|---|
| Message-ID | <[email protected]> |
ae Wed, 11 Dec 2019 17:13:54 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=348492
Log:
Translations by @geekcom - https://github.com/phpdocbrbridge/traducao/pull/97
Changed paths:
U phpdoc/pt_BR/trunk/language/control-structures/break.xml
U phpdoc/pt_BR/trunk/language/control-structures/continue.xml
U phpdoc/pt_BR/trunk/language/control-structures/declare.xml
U phpdoc/pt_BR/trunk/language/control-structures/elseif.xml
U phpdoc/pt_BR/trunk/language/control-structures/foreach.xml
U phpdoc/pt_BR/trunk/language/control-structures/include-once.xml
U phpdoc/pt_BR/trunk/language/control-structures/return.xml
U phpdoc/pt_BR/trunk/language/control-structures/switch.xml
svn-diffs-348492.txt
(text/x-diff, 16.6 KB)
Modified: phpdoc/pt_BR/trunk/language/control-structures/break.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/break.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/break.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 337069 Maintainer: fabioluciano Status: ready --><!-- CREDITS: diegopires, ae, fabioluciano -->
+<!-- EN-Revision: 345956 Maintainer: fabioluciano Status: ready --><!-- CREDITS: diegopires, ae, fabioluciano, @geekcom -->
<sect1 xml:id="control-structures.break" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title><literal>break</literal></title>
@@ -22,7 +22,7 @@
<![CDATA[
<?php
$arr = array('one', 'two', 'three', 'four', 'stop', 'five');
-while (list(, $val) = each($arr)) {
+foreach ($arr as $val) {
if ($val == 'stop') {
break; /* You could also write 'break 1;' here. */
}
@@ -34,14 +34,14 @@
$i = 0;
while (++$i) {
switch ($i) {
- case 5:
- echo "At 5<br />\n";
- break 1; /* Exit only the switch. */
- case 10:
- echo "At 10; quitting<br />\n";
- break 2; /* Exit the switch and the while. */
- default:
- break;
+ case 5:
+ echo "At 5<br />\n";
+ break 1; /* Exit only the switch. */
+ case 10:
+ echo "At 10; quitting<br />\n";
+ break 2; /* Exit the switch and the while. */
+ default:
+ break;
}
}
?>
@@ -61,6 +61,14 @@
</thead>
<tbody>
<row>
+ <entry>7.0.0</entry>
+ <entry>
+ <literal>break</literal> fora de um laço ou de uma estrutura de controle
+ <literal>switch</literal> agora é detectado em tempo de compilação, antes
+ era em tempo de execução, e dispara um erro do tipo <constant>E_COMPILE_ERROR</constant>.
+ </entry>
+ </row>
+ <row>
<entry>5.4.0</entry>
<entry>
<literal>break 0;</literal> não é mais válido. Nas versões anteriores era interpretado
@@ -70,7 +78,7 @@
<row>
<entry>5.4.0</entry>
<entry>
- Removida a possibilidade de passar variáveis como argumento
+ Removida a possibilidade de passar variáveis como argumentos numéricos
(ex., <literal>$num = 2; break $num;</literal>)
</entry>
</row>
Modified: phpdoc/pt_BR/trunk/language/control-structures/continue.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/continue.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/continue.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 338501 Maintainer: fabioluciano Status: ready --><!-- CREDITS: diegopires, ae, diegopires, fabioluciano -->
+<!-- EN-Revision: 348403 Maintainer: fabioluciano Status: ready --><!-- CREDITS: diegopires, ae, diegopires, fabioluciano, @geekcom -->
<sect1 xml:id="control-structures.continue" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title><literal>continue</literal></title>
@@ -13,9 +13,10 @@
<simpara>
No PHP a instrução
<link linkend="control-structures.switch">switch</link> é
- considerado uma estrutura de laço para os propósitos do
+ considerada uma estrutura de laço para os propósitos do
<literal>continue</literal>. O <literal>continue</literal> se comporta como o
- <literal>break</literal> (quando nenhum argumento é passado). Se um
+ <literal>break</literal> (quando nenhum argumento é passado), mas irá
+ gerar um aviso, pois este é susceptível de ser um erro. Se um
<literal>switch</literal> está dentro de um laço,
<literal>continue 2</literal> irá continuar a próxima interação
do laço externo.
@@ -32,7 +33,7 @@
<programlisting role="php">
<![CDATA[
<?php
-while (list($key, $value) = each($arr)) {
+foreach ($arr as $key => $value) {
if (!($key % 2)) { // pula membros pares
continue;
}
@@ -120,6 +121,21 @@
</thead>
<tbody>
<row>
+ <entry>7.3.0</entry>
+ <entry>
+ <literal>continue</literal> dentro de um <literal>switch</literal> que está tentando agir como um <literal>break</literal> para o
+ <literal>switch</literal> irá gerar um <constant>E_WARNING</constant>.
+ </entry>
+ </row>
+ <row>
+ <entry>7.0.0</entry>
+ <entry>
+ <literal>continue</literal> fora de um laço ou fora de uma estrutura de controle
+ <literal>switch</literal> agora é detectado em tempo de compilação, antes era em tempo de execução,
+ e dispara um erro do tipo <constant>E_COMPILE_ERROR</constant>.
+ </entry>
+ </row>
+ <row>
<entry>5.4.0</entry>
<entry>
<literal>continue 0;</literal> não é mais válido. Em versões anteriores era interpretado
@@ -129,7 +145,7 @@
<row>
<entry>5.4.0</entry>
<entry>
- Removida a possibilidade de passar variáveis como argumento
+ Removida a possibilidade de passar variáveis como argumentos numéricos
(ex., <literal>$num = 2; continue $num;</literal>).
</entry>
</row>
Modified: phpdoc/pt_BR/trunk/language/control-structures/declare.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/declare.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/declare.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 338957 Maintainer: ae Status: ready --><!-- CREDITS: diegopires, ae, fabioluciano -->
+<!-- EN-Revision: 347260 Maintainer: ae Status: ready --><!-- CREDITS: diegopires, ae, fabioluciano, @geekcom -->
<sect1 xml:id="control-structures.declare" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title><literal>declare</literal></title>
@@ -46,13 +46,20 @@
</thead>
<tbody>
<row>
- <entry>5.3.0</entry>
- <entry>Adicionada a diretiva encoding</entry>
+ <entry>7.0.0</entry>
+ <entry>Adicionada a diretiva <literal>strict_types</literal></entry>
</row>
<row>
<entry>7.0.0</entry>
- <entry>Adicionada a diretiva strict_types</entry>
+ <entry>
+ A diretiva <literal>ticks</literal> não escapa mais para diferentes
+ unidades de compilação.
+ </entry>
</row>
+ <row>
+ <entry>5.3.0</entry>
+ <entry>Adicionada a diretiva <literal>encoding</literal></entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
@@ -193,7 +200,7 @@
<sect2 xml:id="control-structures.declare.encoding">
<title>Codificação</title>
<para>
- A codificação de um script pode ser especificada, por script, utilizando a diretiva encoding.
+ A codificação de um script pode ser especificada, por script, utilizando a diretiva <literal>encoding</literal>.
<example>
<title>Declarando um encoding para o script.</title>
<programlisting role="php">
Modified: phpdoc/pt_BR/trunk/language/control-structures/elseif.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/elseif.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/elseif.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 312947 Maintainer: fabioluciano Status: ready --><!-- CREDITS: diegopires, fabioluciano -->
+<!-- EN-Revision: 341918 Maintainer: fabioluciano Status: ready --><!-- CREDITS: diegopires, fabioluciano, @geekcom -->
<sect1 xml:id="control-structures.elseif" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title><literal>elseif</literal>/<literal>else if</literal></title>
@@ -69,17 +69,17 @@
<?php
/* Incorrect Method: */
-if($a > $b):
+if ($a > $b):
echo $a." is greater than ".$b;
-else if($a == $b): // Will not compile.
+else if ($a == $b): // Will not compile.
echo "The above line causes a parse error.";
endif;
/* Correct Method: */
-if($a > $b):
+if ($a > $b):
echo $a." is greater than ".$b;
-elseif($a == $b): // Note the combination of the words.
+elseif ($a == $b): // Note the combination of the words.
echo $a." equals ".$b;
else:
echo $a." is neither greater than or equal to ".$b;
Modified: phpdoc/pt_BR/trunk/language/control-structures/foreach.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/foreach.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/foreach.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 339330 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
+<!-- EN-Revision: 345048 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano, @geekcom -->
<sect1 xml:id="control-structures.foreach" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title><literal>foreach</literal></title>
@@ -133,47 +133,6 @@
</note>
</para>
<para>
- Deve-se ter notado que as seguintes funcionalmente
- idênticas:
- <informalexample>
- <programlisting role="php">
-<![CDATA[
-<?php
-$arr = array("one", "two", "three");
-reset($arr);
-while (list(, $value) = each($arr)) {
- echo "Value: $value<br />\n";
-}
-
-foreach ($arr as $value) {
- echo "Value: $value<br />\n";
-}
-?>
-]]>
- </programlisting>
- </informalexample>
- </para>
- <para>
- Os exemplos a seguir também são funcionalmente idênticos.
- <informalexample>
- <programlisting role="php">
-<![CDATA[
-<?php
-$arr = array("one", "two", "three");
-reset($arr);
-while (list($key, $value) = each($arr)) {
- echo "Key: $key; Value: $value<br />\n";
-}
-
-foreach ($arr as $key => $value) {
- echo "Key: $key; Value: $value<br />\n";
-}
-?>
-]]>
- </programlisting>
- </informalexample>
- </para>
- <para>
Mais alguns exemplos para demonstrar o uso:
<informalexample>
<programlisting role="php">
Modified: phpdoc/pt_BR/trunk/language/control-structures/include-once.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/include-once.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/include-once.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 337130 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
+<!-- EN-Revision: 347043 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano, @geekcom -->
<sect1 xml:id="function.include-once" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>include_once</title>
@@ -20,32 +20,8 @@
</para>
<para>
Veja a documentação da declaração <function>include</function> para informações sobre
- como essa função funciona.
+ como esta função funciona.
</para>
- <para>
- <note>
- <para>
- No PHP 4, as funcionalidades <literal>_once</literal> diferem em sistemas
- operacionais case-insensitive (como o Windows), por exemplo
- <example>
- <title>Uso do <literal>include_once</literal> em um SO case insensitive no PHP 4</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-include_once "a.php"; // this will include a.php
-include_once "A.php"; // this will include a.php again! (PHP 4 only)
-?>
-]]>
- </programlisting>
- </example>
- </para>
- <para>
- Este comportamento foi modificado no PHP 5, por exemplo, no Windows o caminho é normalizados primeiro, então isto
- <filename>C:\PROGRA~1\A.php</filename> e o mesmo que
- <filename>C:\Program Files\a.php</filename> e o arquivo é incluído somente uma vez.
- </para>
- </note>
- </para>
</sect1>
<!-- Keep this comment at the end of the file
Modified: phpdoc/pt_BR/trunk/language/control-structures/return.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/return.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/return.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 338310 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
+<!-- EN-Revision: 344782 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano, @geekcom -->
<sect1 xml:id="function.return" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>return</title>
@@ -38,29 +38,18 @@
<note>
<simpara>
Note que, como <literal>return</literal> é um construtor
- de linguagem e não uma função, is parênteses que envolvem seus
- argumentos não são exigidos. É comum omiti-los, e na verdade,
- deve-se fazer, já que o PHP terá menos trabalho a ser feito, neste caso.
+ de linguagem e não uma função, os parênteses que envolvem seus
+ argumentos não são exigidos e seu uso é desencorajado.
</simpara>
</note>
<note>
<simpara>
- Se nenhum parâmentro for informado, e os parênteses omitidos,
+ Se nenhum parâmetro for informado, e os parênteses omitidos,
&null; será
- retornado. Chamar <literal>return</literal> com parênteses, mas
+ retornado. Chamar um <literal>return</literal> com parênteses, mas
sem argumentos resultará em um erro de interpretação.
</simpara>
</note>
- <note>
- <simpara>
- <emphasis>Nunca</emphasis> deve-se utilizar parênteses em torno de sua variável
- de retorno ao retornar por referência, por que isso não funcionará. Pode-se
- retornar variáveis por referência, mas não o resultado de uma declaração. Se
- utilizar <literal>return ($a);</literal> não se estará retornando uma
- variável, mas sim o resultado da expressão <literal>($a)</literal>
- (que, é claro, é o valor de <varname>$a</varname>).
- </simpara>
- </note>
</para>
</sect1>
Modified: phpdoc/pt_BR/trunk/language/control-structures/switch.xml
===================================================================
--- phpdoc/pt_BR/trunk/language/control-structures/switch.xml 2019-12-11 16:00:43 UTC (rev 348491)
+++ phpdoc/pt_BR/trunk/language/control-structures/switch.xml 2019-12-11 17:13:54 UTC (rev 348492)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- EN-Revision: 338959 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano -->
+<!-- EN-Revision: 345106 Maintainer: fabioluciano Status: ready --><!-- CREDITS: fabioluciano, @geekcom -->
<sect1 xml:id="control-structures.switch" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title><literal>switch</literal></title>
@@ -107,8 +107,8 @@
é executada a fim de evitar enganos. A declação
<literal>switch</literal> executa linha por linha
(na verdade, declaração por declaração). No início nenhum código é
- executado. Somente quando uma declaração <literal>case</literal> é encontrada
- com um valores correspondente ao valor da expressão do
+ executado. Somente quando uma declaração <literal>case</literal> é encontrada,
+ cuja expressão avalia um valor que corresponde ao valor do
<literal>switch</literal>, o PHP começará a executar a
declaração. O PHP continuará a executar a declaração até o fim do bloco
<literal>switch</literal>, ou até a primeira declaração
@@ -158,13 +158,13 @@
<![CDATA[
<?php
switch ($i) {
-case 0:
-case 1:
-case 2:
- echo "i is less than 3 but not negative";
- break;
-case 3:
- echo "i is 3";
+ case 0:
+ case 1:
+ case 2:
+ echo "i is less than 3 but not negative";
+ break;
+ case 3:
+ echo "i is 3";
}
?>
]]>
@@ -197,12 +197,6 @@
</informalexample>
</para>
<para>
- A expressão <literal>case</literal>pode ser qualquer expressão
- que avalie um tipo simples, isto é, <type>integer</type> ou número de ponto
- flutuante e <type>string</type>s. <type>Array</type>s or <type>object</type>s não podem ser utilizados
- a não que referenciados para um tipo simples.
- </para>
- <para>
A sintaxe alternativa das estruturas de controle é suportada por
switches. Para mais informações, veja <link
linkend="control-structures.alternative-syntax">Sintaxe alternativa