mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-30 04:42:24 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@164568 c90b9560-bf6c-de11-be94-00142212c4b1
95 lines
2.8 KiB
XML
95 lines
2.8 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.11 $ -->
|
|
<!-- EN-Revision: 1.8 Maintainer: didou Status: ready -->
|
|
<refentry id="function.strstr">
|
|
<refnamediv>
|
|
<refname>strstr</refname>
|
|
<refpurpose>Trouve la première occurrence dans une chaîne</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>strstr</methodname>
|
|
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>needle</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>strstr</function> retourne une sous-chaîne de <parameter>haystack</parameter>,
|
|
allant de la première occurrence de <parameter>needle</parameter> jusqu'à la fin
|
|
de la chaîne.
|
|
</para>
|
|
<para>
|
|
Si <parameter>needle</parameter> est introuvable, <function>strstr</function>
|
|
retourne &false;.
|
|
</para>
|
|
<para>
|
|
Si <parameter>needle</parameter> n'est pas une chaîne, elle
|
|
sera convertie en entier, et utilisée comme code ascii du caractère
|
|
correspondant.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
<function>strstr</function> est sensible à la casse. Pour une fonctionnalité
|
|
identique, mais insensible à la casse, reportez-vous à
|
|
<function>stristr</function>.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>strstr</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$email = 'user@example.com';
|
|
$domaine = strstr($email, '@');
|
|
echo $domaine; // @example.com
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<note>
|
|
<para>
|
|
Si vous voulez juste déterminer si un <parameter>needle</parameter> particulier
|
|
se trouve dans la chaîne <parameter>haystack</parameter>, utilisez la fonction
|
|
<function>strpos</function> qui est plus rapide et qui consomme moins de ressources.
|
|
</para>
|
|
</note>
|
|
</para>
|
|
<para>
|
|
<function>strstr</function> a été protégé des données binaires depuis &php; 4.3.0.
|
|
</para>
|
|
<para>
|
|
Voir aussi
|
|
<function>ereg</function>,
|
|
<function>preg_match</function>,
|
|
<function>stristr</function>,
|
|
<function>strpos</function>,
|
|
<function>strrchr</function> et
|
|
<function>substr</function>.
|
|
</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:"../../../../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
|
|
-->
|