mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-28 11:13:14 +02:00
b62d2b7602
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@164657 c90b9560-bf6c-de11-be94-00142212c4b1
113 lines
3.5 KiB
XML
Executable File
113 lines
3.5 KiB
XML
Executable File
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.9 $ -->
|
|
<!-- EN-Revision: 1.5 Maintainer: yannick Status: ready -->
|
|
<refentry id="function.stripos">
|
|
<refnamediv>
|
|
<refname>stripos</refname>
|
|
<refpurpose>
|
|
Recherche la première occurrence dans une chaîne, sans tenir compte de la casse
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>stripos</methodname>
|
|
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>needle</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>stripos</function> retourne la position numérique
|
|
de la première occurrence de <parameter>needle</parameter> dans la chaîne
|
|
<parameter>haystack</parameter>. Contrairement à <function>strpos</function>,
|
|
<function>stripos</function> est insensible à la casse. Et, contrairement
|
|
à <function>strrpos</function>, cette fonction peut prendre une chaîne
|
|
complète comme paramètre <parameter>needle</parameter> et cette chaîne complète
|
|
sera utilisée pour la recherche.
|
|
</para>
|
|
<para>
|
|
Si le paramètre <parameter>needle</parameter> n'est pas trouvé,
|
|
<function>strpos</function> retournera &false;.
|
|
</para>
|
|
|
|
&return.falseproblem;
|
|
|
|
<para>
|
|
<example>
|
|
<title>Exemples avec <function>stripos</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$findme = 'a';
|
|
$mystring1 = 'xyz';
|
|
$mystring2 = 'ABC';
|
|
|
|
$pos1 = stripos($mystring1, $findme);
|
|
$pos2 = stripos($mystring2, $findme);
|
|
|
|
// Non, 'a' ne fait pas partie de 'xyz'
|
|
if ($pos1 === false) {
|
|
echo "La chaîne '$findme' n'a pas été trouvée dans la chaîne '$mystring'";
|
|
}
|
|
|
|
// Notez l'utilisation de ===. Un simple == ne donnerait pas le résultat escompté
|
|
// car la lettre 'a' est à la position 0th (la première).
|
|
if ($pos2 !== false) {
|
|
echo "La chaîne '$findme' a été trouvée dans la chaîne '$mystring'";
|
|
echo " à la position $pos";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Si <parameter>needle</parameter> n'est pas une chaîne, elle est
|
|
convertie en entier, et utilisé comme caractère de code ASCII
|
|
correspondant.
|
|
</para>
|
|
<para>
|
|
Le paramètre optionnel <parameter>offset</parameter> vous permet
|
|
de spécifier à partir de quel caractère dans
|
|
<parameter>haystack</parameter>
|
|
vous souhaitez commencer la recherche. La position retournée sera toujours
|
|
relative au début de la chaîne <parameter>haystack</parameter>.
|
|
</para>
|
|
|
|
¬e.bin-safe;
|
|
|
|
<para>
|
|
Voir aussi
|
|
<function>strpos</function>,
|
|
<function>strrpos</function>,
|
|
<function>strrchr</function>,
|
|
<function>substr</function>,
|
|
<function>stristr</function>,
|
|
<function>strstr</function>,
|
|
<function>strripos</function> et
|
|
<function>str_ireplace</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
|
|
-->
|