Files
archived-doc-pt-br/reference/array/functions/array-first.xml
Leonardo Lara Rodrigues 6ea5d38a77 sync with en rev
2025-11-05 17:18:25 -03:00

94 lines
2.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?><!-- EN-Revision: b68b5e427e7454a59437dd6f7ff27b4f9228fe6d Maintainer: leonardolara Status: ready --><!-- CREDITS: leonardolara -->
<refentry xml:id="function.array-first" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>array_first</refname>
<refpurpose>Obtém o primeiro valor de um array</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>array_first</methodname>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
</methodsynopsis>
<simpara>
Obtém o primeiro valor do <parameter>array</parameter> fornecido.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>array</parameter></term>
<listitem>
<simpara>
Um array.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Retorna o primeiro valor de <parameter>array</parameter> se o array não estiver vazio;
&null; caso contrário.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="array_first.example.basic">
<title>Uso básico de <function>array_first</function></title>
<programlisting role="php">
<![CDATA[
<?php
$array = [1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd'];
$firstValue = array_first($array);
var_dump($firstValue);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
string(1) "a"
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>array_key_first</function></member>
<member><function>array_last</function></member>
</simplelist>
</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
-->