mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
sync with en rev
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 9cd8eb0f11edb4e59fd22f723137bbb91d6ab64f Maintainer: leonardolara Status: ready --><!-- CREDITS: adiel, ae, atomotavio, fabioluciano, felipe, klaussilveira, rafaelbernard, leonardolara, fernandowobeto -->
|
||||
<!-- EN-Revision: 8b502f81f951a1af64396b69823f7a35b7637541 Maintainer: leonardolara Status: ready --><!-- CREDITS: adiel, ae, atomotavio, fabioluciano, felipe, klaussilveira, rafaelbernard, leonardolara, fernandowobeto -->
|
||||
|
||||
<!ENTITY installation.enabled.disable 'Esta extensão está habilitada por padrão. Ela pode ser desabilitada usando a seguinte opção em tempo de compilação: '>
|
||||
|
||||
@@ -4370,7 +4370,7 @@ local: {
|
||||
<para>
|
||||
Se omitido, <constant>FILTER_DEFAULT</constant> será usado, que é
|
||||
equivalente a
|
||||
<link linkend="filter.filters.sanitize"><constant>FILTER_UNSAFE_RAW</constant></link>.
|
||||
<constant>FILTER_UNSAFE_RAW</constant>.
|
||||
Isso resultará em nenhuma filtragem ocorrendo por padrão.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- EN-Revision: 43d07782b514d0c7a8487f2c74063739f302df8d Maintainer: ae Status: ready -->
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- EN-Revision: c35ad60a7f790d735bbdca01c6baaf65d4867330 Maintainer: ae Status: ready --><!-- CREDITS: ae, leonardolara -->
|
||||
<sect1 xml:id="language.operators.arithmetic">
|
||||
<title>Operadores Aritméticos</title>
|
||||
<titleabbrev>Aritméticos</titleabbrev>
|
||||
@@ -18,7 +18,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>+$a</entry>
|
||||
<entry><code>+$a</code></entry>
|
||||
<entry>Identidade</entry>
|
||||
<entry>
|
||||
Conversão de <varname>$a</varname> para <type>int</type> ou
|
||||
@@ -26,37 +26,37 @@
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>-$a</entry>
|
||||
<entry><code>-$a</code></entry>
|
||||
<entry>Negativação</entry>
|
||||
<entry>Oposto de <varname>$a</varname>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>$a + $b</entry>
|
||||
<entry><code>$a + $b</code></entry>
|
||||
<entry>Adição</entry>
|
||||
<entry>Soma de <varname>$a</varname> e <varname>$b</varname>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>$a - $b</entry>
|
||||
<entry><code>$a - $b</code></entry>
|
||||
<entry>Subtração</entry>
|
||||
<entry>Diferença entre <varname>$a</varname> e <varname>$b</varname>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>$a * $b</entry>
|
||||
<entry><code>$a * $b</code></entry>
|
||||
<entry>Multiplicação</entry>
|
||||
<entry>Produto de <varname>$a</varname> e <varname>$b</varname>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>$a / $b</entry>
|
||||
<entry><code>$a / $b</code></entry>
|
||||
<entry>Divisão</entry>
|
||||
<entry>Quociente de <varname>$a</varname> e <varname>$b</varname>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>$a % $b</entry>
|
||||
<entry><code>$a % $b</code></entry>
|
||||
<entry>Resto</entry>
|
||||
<entry>Resto de <varname>$a</varname> dividido por <varname>$b</varname>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>$a ** $b</entry>
|
||||
<entry><code>$a ** $b</code></entry>
|
||||
<entry>Exponenciação</entry>
|
||||
<entry>Resultado de <varname>$a</varname> elevado à potência de <varname>$b</varname>.</entry>
|
||||
</row>
|
||||
@@ -64,10 +64,12 @@
|
||||
</tgroup>
|
||||
</table>
|
||||
<simpara>
|
||||
O operador de divisão ("/") sempre retorna um valor com ponto flutuante,
|
||||
a não ser que os dois operandos sejam inteiros (ou strings que são convertidas para inteiros)
|
||||
e números inteiramente divisíveis, nesse caso um inteiro é retornado. Para
|
||||
divisão de inteiros, veja <function>intdiv</function>.
|
||||
O operador de divisão <literal>/</literal> retorna um valor <type>float</type>,
|
||||
a não ser que os dois operandos sejam <type>int</type> (ou
|
||||
<link linkend="language.types.numeric-strings">strings numéricas</link>
|
||||
que são convertidas para <type>int</type>) e o numerador seja um múltiplo
|
||||
do divisor, neste caso será retornado um valor inteiro.
|
||||
Para divisão de inteiros, consulte <function>intdiv</function>.
|
||||
</simpara>
|
||||
<simpara>
|
||||
Operandos da operação de resto de divisão são convertidos para <type>int</type>
|
||||
@@ -76,21 +78,30 @@
|
||||
</simpara>
|
||||
<para>
|
||||
O resultado do operador de resto <literal>%</literal> tem o mesmo sinal
|
||||
do dividendo — ou seja, o resultado de <literal>$a % $b</literal>
|
||||
do dividendo — ou seja, o resultado de <code>$a % $b</code>
|
||||
terá o mesmo sinal de <varname>$a</varname>. Exemplos:
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
echo (5 % 3)."\n"; // exibe 2
|
||||
echo (5 % -3)."\n"; // exibe 2
|
||||
echo (-5 % 3)."\n"; // exibe -2
|
||||
echo (-5 % -3)."\n"; // exibe -2
|
||||
var_dump(5 % 3);
|
||||
var_dump(5 % -3);
|
||||
var_dump(-5 % 3);
|
||||
var_dump(-5 % -3);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(2)
|
||||
int(2)
|
||||
int(-2)
|
||||
int(-2)
|
||||
]]>
|
||||
</screen>
|
||||
</informalexample>
|
||||
</para>
|
||||
<sect2 role="seealso">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 54eaf4ed9edc37074870a13dc0de605df4285c3b Maintainer: rafaelbernard Status: ready --><!-- CREDITS: felipe,rafaelbernard,ae,leonardolara -->
|
||||
<!-- EN-Revision: 2f3041da4f16bdfec5d0de1bdc9a1c4438d2db91 Maintainer: rafaelbernard Status: ready --><!-- CREDITS: felipe,rafaelbernard,ae,leonardolara -->
|
||||
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
|
||||
<appendix xml:id="filter.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
&reftitle.constants;
|
||||
@@ -1039,11 +1039,75 @@
|
||||
(<type>int</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<!-- TODO: Document how to use this filter, see user notes on manual page:
|
||||
https://www.php.net/manual/en/filter.filters.misc.php -->
|
||||
<simpara>
|
||||
ID do filtro "callback".
|
||||
Este filtro delega a filtragem a uma função definida pelo usuário.
|
||||
O <type>callable</type> é passado através do
|
||||
parâmetro <parameter>options</parameter> comom o valor associado à
|
||||
chave <literal>'options'</literal>.
|
||||
</simpara>
|
||||
<para>
|
||||
A função deve ter a seguinte assinatura:
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname><replaceable>callback</replaceable></methodname>
|
||||
<methodparam><type>string</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<variablelist role="function_parameters">
|
||||
<varlistentry>
|
||||
<term><parameter>value</parameter></term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
O valor a ser filtrado.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
<note>
|
||||
<simpara>
|
||||
O valor retornado pela função será o valor retornado pela
|
||||
função de filtro chamada.
|
||||
</simpara>
|
||||
</note>
|
||||
<example>
|
||||
<title>
|
||||
Examplo de uso de <constant>FILTER_CALLBACK</constant> para validar
|
||||
um login
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function validate_login($value): ?string
|
||||
{
|
||||
if (strlen($value) >= 5 && ctype_alnum($value)) {
|
||||
return $value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
$login = "L0ginValido";
|
||||
$filtered_login = filter_var($login, FILTER_CALLBACK, ['options' => 'validate_login']);
|
||||
var_dump($filtered_login);
|
||||
|
||||
$login = "login f&lso";
|
||||
$filtered_login = filter_var($login, FILTER_CALLBACK, ['options' => 'validate_login']);
|
||||
var_dump($filtered_login);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
string(11) "L0ginValido"
|
||||
NULL
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<warning>
|
||||
<simpara>
|
||||
Este filtro não pode ser usado com nenhuma outra opção de filtro, como por exemplo,
|
||||
<constant>FILTER_NULL_ON_FAILURE</constant>.
|
||||
</simpara>
|
||||
</warning>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 247c617b3d54ac8b8fcd8d82516a476c751ddafd Maintainer: fernandowobeto Status: ready --><!-- CREDITS: fernandowobeto -->
|
||||
<!-- EN-Revision: ce3a6b07e255897b67c74824aebaf0ccb89b86d3 Maintainer: leonardolara Status: ready --><!-- CREDITS: fernandowobeto, leonardolara -->
|
||||
|
||||
<chapter xml:id="filter.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
&reftitle.examples;
|
||||
@@ -151,17 +151,6 @@ Depois: bogus@example.org
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Configurando um filtro padrão</title>
|
||||
<programlisting role="php" xml:id="filter.examples.sanitization.default_filter">
|
||||
<![CDATA[
|
||||
filter.default = full_special_chars
|
||||
filter.default_flags = 0
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 764051c2ecd3e5388559a15210a5ee1fa9b426b9 Maintainer: ae Status: ready --><!-- CREDITS: everaldofilho,ae,leonardolara -->
|
||||
<!-- EN-Revision: 2f3041da4f16bdfec5d0de1bdc9a1c4438d2db91 Maintainer: ae Status: ready --><!-- CREDITS: everaldofilho,ae,leonardolara -->
|
||||
<chapter xml:id="filter.filters" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Tipos de filtros</title>
|
||||
|
||||
<!-- Sanitize filters: {{{-->
|
||||
<section xml:id="filter.filters.sanitize">
|
||||
<title>Filtros de Sanitize (Limpeza)</title>
|
||||
<title>Filtros de Sanitização</title>
|
||||
<para>
|
||||
<table>
|
||||
<title>Lista de filtros para sanitização (Limpeza)</title>
|
||||
<title>Lista de filtros para sanitização</title>
|
||||
<tgroup cols="5">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>ID</entry>
|
||||
<entry>Nome</entry>
|
||||
<entry>Flags</entry>
|
||||
<entry>Opções</entry>
|
||||
<entry>Descrição</entry>
|
||||
</row>
|
||||
</thead>
|
||||
@@ -29,7 +29,7 @@
|
||||
<constant>FILTER_FLAG_ENCODE_LOW</constant>,
|
||||
<constant>FILTER_FLAG_ENCODE_HIGH</constant>
|
||||
</entry>
|
||||
<entry>URL-encode string, opcionalmente tira ou codifica caracteres especiais.</entry>
|
||||
<entry>String codificada como URL, opcionalmente tira ou codifica caracteres especiais.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><constant>FILTER_SANITIZE_SPECIAL_CHARS</constant></entry>
|
||||
@@ -41,8 +41,8 @@
|
||||
<constant>FILTER_FLAG_ENCODE_HIGH</constant>
|
||||
</entry>
|
||||
<entry>
|
||||
Codifica em HTML <literal>'"<>&</literal> e caracteres com
|
||||
valor ASCII menor que 32, opcionalmente, tira ou codifica outros
|
||||
Codifica em HTML os caracteres <literal>'"<>&</literal> e os caracteres com
|
||||
valor ASCII menor que 32; opcionalmente, tira ou codifica outros
|
||||
caracteres especiais.
|
||||
</entry>
|
||||
</row>
|
||||
@@ -73,7 +73,7 @@
|
||||
<constant>FILTER_FLAG_ENCODE_AMP</constant>
|
||||
</entry>
|
||||
<entry>
|
||||
Remove tags e codifica aspas duplas e simples no estilo HTML, opcionalmente remove
|
||||
Remove etiquetas e codifica aspas duplas e simples no estilo HTML, opcionalmente remove
|
||||
ou codifica caracteres HTML especiais. Codificar aspas pode ser
|
||||
desligado ao ativar <constant>FILTER_FLAG_NO_ENCODE_QUOTES</constant>
|
||||
(<emphasis>Descontinuado</emphasis> desde o PHP 8.1.0,
|
||||
@@ -92,8 +92,8 @@
|
||||
<constant>FILTER_FLAG_ENCODE_AMP</constant>
|
||||
</entry>
|
||||
<entry>
|
||||
Não faz nada, opcionalmente descasque ou codifique caracteres especiais. este
|
||||
filtro também é alias do <constant>FILTER_DEFAULT</constant>.
|
||||
Não faz nada, opcionalmente remove ou codifica caracteres especiais. Este
|
||||
filtro também é sinônimo de <constant>FILTER_DEFAULT</constant>.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
@@ -129,40 +129,9 @@
|
||||
</section>
|
||||
<!--}}}-->
|
||||
|
||||
<!-- Other filters: {{{-->
|
||||
<section xml:id="filter.filters.misc">
|
||||
<title>Outros filtros</title>
|
||||
<para>
|
||||
<table>
|
||||
<title>Lista de filtros diversos</title>
|
||||
<tgroup cols="5">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>ID</entry>
|
||||
<entry>Nome</entry>
|
||||
<entry>Opções</entry>
|
||||
<entry>Flags</entry>
|
||||
<entry>Descrição</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><constant>FILTER_CALLBACK</constant></entry>
|
||||
<entry>"callback"</entry>
|
||||
<entry><type>callable</type> função ou método</entry>
|
||||
<entry>Todas as flags são ignoradas</entry>
|
||||
<entry>Chama a função definida pelo usuário para filtrar os dados.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
</section>
|
||||
<!--}}}-->
|
||||
|
||||
<!-- Filter flags: {{{-->
|
||||
<section xml:id="filter.filters.flags">
|
||||
<title>Filtro flags</title>
|
||||
<title>Opções de filtragem</title>
|
||||
|
||||
<para>
|
||||
<table>
|
||||
@@ -218,8 +187,8 @@
|
||||
<constant>FILTER_SANITIZE_STRING</constant>
|
||||
</entry>
|
||||
<entry>
|
||||
Se este flag estiver presente, Aspas simples (<literal>'</literal>) e duplas
|
||||
(<literal>"</literal>) duplas não serão codificadas.
|
||||
Se esta opção estiver presente, aspas simples (<literal>'</literal>) e duplas
|
||||
(<literal>"</literal>) não serão codificadas.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 83a17a7324c2597bd6385148abf19f76127229f5 Maintainer: leonardolara Status: ready -->
|
||||
<!-- EN-Revision: 31b6ff768992a82022aade13880c595e19e054ba Maintainer: leonardolara Status: ready -->
|
||||
<refentry xml:id="function.is-callable" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>is_callable</refname>
|
||||
<refpurpose>
|
||||
Verifica se um valor pode ser chamado como uma função a partir do escopo atual.
|
||||
Verifica se um valor pode ser chamado como uma função a partir do escopo atual
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
@@ -77,42 +77,37 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Como verificar uma variável para ver se ela pode ser chamada
|
||||
// como uma função.
|
||||
// Como verificar uma variável para ver se ela pode ser chamada
|
||||
// como uma função
|
||||
|
||||
//
|
||||
// Variável simples contendo uma função
|
||||
// Variável simples contendo uma função
|
||||
//
|
||||
|
||||
function someFunction()
|
||||
{
|
||||
}
|
||||
function someFunction() {}
|
||||
|
||||
$functionVariable = 'someFunction';
|
||||
|
||||
var_dump(is_callable($functionVariable, false, $callable_name)); // bool(true)
|
||||
var_dump(is_callable($functionVariable, false, $callable_name)); // bool(true)
|
||||
|
||||
echo $callable_name, "\n"; // someFunction
|
||||
echo $callable_name, "\n"; // someFunction
|
||||
|
||||
//
|
||||
// Array contendo um método
|
||||
// Array contendo um método
|
||||
//
|
||||
|
||||
class someClass {
|
||||
|
||||
function someMethod()
|
||||
{
|
||||
}
|
||||
|
||||
class someClass
|
||||
{
|
||||
function someMethod() {}
|
||||
}
|
||||
|
||||
$anObject = new someClass();
|
||||
|
||||
$methodVariable = array($anObject, 'someMethod');
|
||||
$methodVariable = [$anObject, 'someMethod'];
|
||||
|
||||
var_dump(is_callable($methodVariable, true, $callable_name)); // bool(true)
|
||||
var_dump(is_callable($methodVariable, true, $callable_name)); // bool(true)
|
||||
|
||||
echo $callable_name, "\n"; // someClass::someMethod
|
||||
echo $callable_name, "\n"; // someClass::someMethod
|
||||
|
||||
?>
|
||||
]]>
|
||||
@@ -131,13 +126,16 @@ echo $callable_name, "\n"; // someClass::someMethod
|
||||
class Foo
|
||||
{
|
||||
public function __construct() {}
|
||||
|
||||
public function foo() {}
|
||||
}
|
||||
|
||||
var_dump(
|
||||
is_callable(array('Foo', '__construct')),
|
||||
is_callable(array('Foo', 'foo'))
|
||||
is_callable(['Foo', '__construct']),
|
||||
is_callable(['Foo', 'foo'])
|
||||
);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- EN-Revision: 07e6a4aaa2d28b6218a362b05e573fb13267358d Maintainer: leonardolara Status: ready --><!-- CREDITS: felipe,leonardolara -->
|
||||
<!-- EN-Revision: d5ae08740fd16598ce24f7191a06665bf0ad370f Maintainer: leonardolara Status: ready --><!-- CREDITS: felipe,leonardolara -->
|
||||
<refentry xml:id="xsltprocessor.importstylesheet" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>XSLTProcessor::importStylesheet</refname>
|
||||
@@ -38,6 +38,38 @@
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<simpara>
|
||||
Lança uma exceção <exceptionname>TypeError</exceptionname> se
|
||||
<parameter>stylesheet</parameter> não for um objeto XML.
|
||||
</simpara>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="changelog">
|
||||
&reftitle.changelog;
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>&Version;</entry>
|
||||
<entry>&Description;</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>8.4.0</entry>
|
||||
<entry>
|
||||
Agora lança uma exceção <exceptionname>TypeError</exceptionname> ao invés de uma
|
||||
exceção <exceptionname>ValueError</exceptionname> se
|
||||
<parameter>stylesheet</parameter> não for um objeto XML.
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
||||
Reference in New Issue
Block a user