mirror of
https://github.com/php/doc-it.git
synced 2026-04-25 00:08:20 +02:00
2769b12f1b
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314558 c90b9560-bf6c-de11-be94-00142212c4b1
104 lines
3.2 KiB
XML
104 lines
3.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: n/a Maintainer: darvina Status: ready -->
|
|
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.8 -->
|
|
<refentry xml:id="function.strrpos" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>strrpos</refname>
|
|
<refpurpose>
|
|
Trova la posizione dell'ultima occorrenza di un carattere in una stringa
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrizione</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>strrpos</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>
|
|
Restituisce la posizione numerica dell'ultima occorrenza di
|
|
<parameter>needle</parameter> nella stringa
|
|
<parameter>haystack</parameter>. Fare attenzione che <parameter>needle</parameter>,
|
|
in PHP 4, può essere solo un singolo carattere. Se si passa una stringa,
|
|
verrà utilizzato solo il primo
|
|
carattere.
|
|
</para>
|
|
<para>
|
|
Se <parameter>needle</parameter> non viene trovato, la funzione restituisce &false;.
|
|
</para>
|
|
<para>
|
|
Si può facilmente confondere i valori restituiti "per carattere alla
|
|
posizione 0" e per "carattere non trovato". Ecco come rilevare
|
|
la differenza:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// in PHP 4.0b3 e successivi:
|
|
$pos = strrpos($mystring, "b");
|
|
if ($pos === false) { // note: three equal signs
|
|
// not found...
|
|
}
|
|
|
|
// nelle versioni precedenti alla 4.0b3:
|
|
$pos = strrpos($mystring, "b");
|
|
if (is_bool($pos) && !$pos) {
|
|
// not found...
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
Se <parameter>needle</parameter> non è una stringa, viene convertito in
|
|
un intero, e usato come valore ordinale di un carattere.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Dal PHP 5.0.0 <parameter>offset</parameter> può
|
|
essere indicato per indicare di iniziare la ricerca nella stringa da una
|
|
posizione di caratteri arbitraria. Valori negativi fermeranno la ricerca ad un punto arbitrario
|
|
prima della fine della stringa.
|
|
</simpara>
|
|
</note>
|
|
<note>
|
|
<simpara>
|
|
Il parametro <parameter>needle</parameter> può essere una stringa di uno o più
|
|
caratteri a partire dal PHP 5.0.0.
|
|
</simpara>
|
|
</note>
|
|
<para>
|
|
Vedere anche: <function>strpos</function>,
|
|
<function>strripos</function>,
|
|
<function>strrchr</function>,
|
|
<function>substr</function>,
|
|
<function>stristr</function> e
|
|
<function>strstr</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:"~/.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
|
|
-->
|