mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-24 07:02:09 +01:00
114 lines
2.9 KiB
XML
114 lines
2.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?><!-- EN-Revision: 2e60c5134e7a847c99f81eb3f7ecee1f5efeeace Maintainer: leonardolara Status: ready --><!-- CREDITS: marcosmarcolin,leonardolara -->
|
|
<refentry xml:id="function.array-is-list" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_is_list</refname>
|
|
<refpurpose>Verifica se um <parameter>array</parameter> é uma lista</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>array_is_list</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Determina se o <parameter>array</parameter> fornecido é uma lista.
|
|
Um &array; é considerado uma lista se suas chaves consistirem em números consecutivos
|
|
de <literal>0</literal> a <literal>count($array)-1</literal>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>array</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
O &array; que está sendo avaliado.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retorna &true; se <parameter>array</parameter> for uma lista, &false;
|
|
caso contrário.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemplo de <function>array_is_list</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
var_dump(array_is_list([])); // true
|
|
var_dump(array_is_list(['maçã', 2, 3])); // true
|
|
var_dump(array_is_list([0 => 'maçã', 'laranja'])); // true
|
|
|
|
// O array não começa em 0
|
|
var_dump(array_is_list([1 => 'maçã', 'laranja'])); // false
|
|
|
|
// As chaves não estão na ordem correta
|
|
var_dump(array_is_list([1 => 'maçã', 0 => 'laranja'])); // false
|
|
|
|
// Chaves não inteiras
|
|
var_dump(array_is_list([0 => 'maçã', 'foo' => 'bar'])); // false
|
|
|
|
// Chaves não consecutivas
|
|
var_dump(array_is_list([0 => 'maçã', 2 => 'bar'])); // false
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
Esta função retorna &true; em arrays vazios.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>array_values</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|