1
0
mirror of https://github.com/php/doc-it.git synced 2026-03-25 16:12:17 +01:00
Files
Marco Cucinato 581eb95038 accent errors: poichè -> poiché
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@327389 c90b9560-bf6c-de11-be94-00142212c4b1
2012-08-30 22:17:13 +00:00

103 lines
3.3 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.strpos" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>strpos</refname>
<refpurpose>
Trova la posizione della prima occorrenza di una stringa
</refpurpose>
</refnamediv>
<refsect1>
<title>Descrizione</title>
<methodsynopsis>
<type>int</type><methodname>strpos</methodname>
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
<methodparam><type>mixed</type><parameter>needle</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Restituisce la posizione numerica della prima occorrenza di
<parameter>needle</parameter> nella stringa
<parameter>haystack</parameter>. Differentemente rispetto a
<function>strrpos</function>, questa funzione considera tutta la stringa
<parameter>needle</parameter>, e, quindi, cercherà tutta
la stringa.
</para>
<para>
Se <parameter>needle</parameter> non viene trovato
<function>strpos</function> restituirà <type>boolean</type> &false;.
</para>
&return.falseproblem;
&note.bin-safe;
<para>
<example>
<title>Esempio di uso di <function>strpos</function></title>
<programlisting role="php">
<![CDATA[
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
// Notate l'uso di ===. Il == non avrebbe risposto come atteso
// poiché la posizione di 'a' è nel primo carattere.
if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}
// Ricerca di un carattere ignorando qualsiasi cosa prima di offset
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
?>
]]>
</programlisting>
</example>
</para>
<para>
Se <parameter>needle</parameter> non è una stringa, viene convertito
in un intero e utilizzato come valore ordinale di un carattere.
</para>
<para>
Il parametro opzionale <parameter>offset</parameter> permette di indicare
da quale carattere in <parameter>haystack</parameter>
iniziare la ricerca. La posizione restituita è, comunque, relativa
all'inizio di <parameter>haystack</parameter>.
</para>
<para>
Vedere anche <function>strrpos</function>,
<function>stripos</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
-->