mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-25 17:32:07 +01:00
The original documentation was updated with only a typo in the word "beginning", so nothing to update in French: http://doc.php.net/revcheck.php?p=plain&lang=fr&hbp=e095023e408c8cb6378ae16bb6870343a3946919&f=reference/strings/functions/stripos.xml&c=on
192 lines
5.4 KiB
XML
Executable File
192 lines
5.4 KiB
XML
Executable File
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 89a80389d474b16b8e063d058506a19beaf32db7 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="function.stripos" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>stripos</refname>
|
|
<refpurpose>Recherche la position de la première occurrence dans une chaîne, sans tenir compte de la casse</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>int</type><type>false</type></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><initializer>0</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Cherche la position numérique de la première occurrence de
|
|
<parameter>needle</parameter> dans la chaîne <parameter>haystack</parameter>.
|
|
</para>
|
|
<para>
|
|
Contrairement à la fonction <function>strpos</function>,
|
|
<function>stripos</function> est insensible à la casse.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>haystack</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La chaîne dans laquelle on effectue la recherche.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>needle</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le paramètre <parameter>needle</parameter> peut être une chaîne d'un
|
|
ou plusieurs caractères.
|
|
</para>
|
|
&strings.parameter.needle.non-string;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>offset</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si spécifié, la recherche commencera à partir de ce nombre
|
|
de caractères, compté depuis le début de la chaîne. Si la position
|
|
est négative, la recherche commencera en utilisant ce nombre de caractères
|
|
mais en commençant par la fin de la chaîne.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne la position de la première occurrence dans la chaîne
|
|
relativement au début de la chaîne <parameter>haystack</parameter>
|
|
(indépendamment de l'offset). Notez également que la position
|
|
dans la chaîne commence à 0, et non pas à 1.
|
|
</para>
|
|
<para>
|
|
Retourne &false; si l'occurrence n'a pas été trouvée.
|
|
</para>
|
|
&return.falseproblem;
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
Passing an &integer; as <parameter>needle</parameter> is no longer supported.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7.3.0</entry>
|
|
<entry>
|
|
Passer un &integer; comme <parameter>before_needle</parameter> a été
|
|
rendu obsolète.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>7.1.0</entry>
|
|
<entry>
|
|
Ajout du support des nombres négatifs pour le paramètre <parameter>offset</parameter>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple 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 '$mystring1'";
|
|
}
|
|
|
|
// 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 '$mystring2'";
|
|
echo " à la position $pos2";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
¬e.bin-safe;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>mb_stripos</function></member>
|
|
<member><function>str_contains</function></member>
|
|
<member><function>str_ends_with</function></member>
|
|
<member><function>str_starts_with</function></member>
|
|
<member><function>strpos</function></member>
|
|
<member><function>strrpos</function></member>
|
|
<member><function>strripos</function></member>
|
|
<member><function>stristr</function></member>
|
|
<member><function>substr</function></member>
|
|
<member><function>str_ireplace</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
|
|
-->
|