mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 16:32:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@323221 c90b9560-bf6c-de11-be94-00142212c4b1
167 lines
4.4 KiB
XML
167 lines
4.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 1d04cd176bfc8f28cdcbb742d4a6eff6f2842adc Maintainer: jpberdejo Status: ready -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strstr">
|
|
<refnamediv>
|
|
<refname>strstr</refname>
|
|
<refpurpose>Encuentra la primera aparición de un string</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>strstr</methodname>
|
|
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
|
|
<methodparam><type>mixed</type><parameter>needle</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>before_needle</parameter><initializer>false</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Devuelve parte del string <parameter>haystack</parameter> iniciando desde e incluyendo la primera
|
|
aparición de <parameter>needle</parameter> (aguja) hasta el final del
|
|
<parameter>haystack</parameter> (pajar).
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Esta función es sensible a mayúsculas. Para búsquedas sin importar las mayúsculas, use
|
|
<function>stristr</function>.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Si solo se quiere saber si un <parameter>needle</parameter> determinado
|
|
aparece en un <parameter>haystack</parameter>, se utiliza la función <function>strpos</function>
|
|
que es más rápida y requiere menos memoria.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>haystack</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El string en donde buscar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>needle</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si <parameter>needle</parameter> no es un string, será convertido
|
|
como número entero y se aplicará el valor ordinal de caracter.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>before_needle</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si se define como &true;, <function>strstr</function> devolverá
|
|
la parte del <parameter>haystack</parameter> antes de la primera
|
|
ocurrencia de <parameter>needle</parameter> (excluyendo el needle).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve una parte de un string o &false; si no se encuentra el
|
|
<parameter>needle</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.3.0</entry>
|
|
<entry>
|
|
Se añadió el parámetro opcional <parameter>before_needle</parameter>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>4.3.0</entry>
|
|
<entry>
|
|
<function>strstr</function> se hizo segura binariamente.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>strstr</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$email = 'name@example.com';
|
|
$domain = strstr($email, '@');
|
|
echo $domain; // mostrará @example.com
|
|
|
|
$user = strstr($email, '@', true); // Desde PHP 5.3.0
|
|
echo $user; // mostrará name
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>stristr</function></member>
|
|
<member><function>strrchr</function></member>
|
|
<member><function>strpos</function></member>
|
|
<member><function>strpbrk</function></member>
|
|
<member><function>preg_match</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
|
|
-->
|