1
0
mirror of https://github.com/php/doc-it.git synced 2026-03-24 07:32:12 +01:00
Files
Richard Quadling 21aa6ad9fe Reencode XML to UTF-8
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314552 c90b9560-bf6c-de11-be94-00142212c4b1
2011-08-08 16:25:22 +00:00

88 lines
2.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- splitted from ./it/functions/network.xml, last change in rev 1.10 -->
<!-- last change to 'ip2long' in en/ tree in rev 1.18 -->
<!-- EN-Revision: n/a Maintainer: cortesi Status: ready -->
<!-- OLD-Revision: 1.60/EN.1.18 -->
<refentry xml:id="function.ip2long" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>ip2long</refname>
<refpurpose>
Converts a string containing an (IPv4) Internet Protocol dotted address
into a proper address.
Converte una stringa contenente un indirizzo di rete del Protocollo Internet (IPv4)
in un indirizzo espresso come tipo di dato int.
</refpurpose>
</refnamediv>
<refsect1>
<title>Descrizione</title>
<methodsynopsis>
<type>int</type><methodname>ip2long</methodname>
<methodparam><type>string</type><parameter>indirizzo_ip</parameter></methodparam>
</methodsynopsis>
<para>
La funzione <function>ip2long</function> genera un indirizzo di rete Internet IPv4
a partire dalla rappresentazione in formato standard
(stringa separata da punti).
<example>
<title>Esempio di <function>ip2long</function></title>
<programlisting role="php">
<![CDATA[
<?php
$ip = gethostbyname("www.php.net");
$out = "I seguenti URL sono equivalenti:<br>\n";
$out .= "http://www.php.net/, http://".$ip."/, e http://".sprintf("%u",ip2long($ip))."/<br>\n";
echo $out;
?>
]]>
</programlisting>
</example>
<note>
<para>
Poiché il tipo di dato integer in PHP è signed e molti indirizzi IP risulterebbero essere
interi negativi, è necessario usare il formattatore "%u" della funzione
<function>sprintf</function> e <function>printf</function> per ottenere
la rappresentazione in stringa dell'indirizzo IP in modo nsigned.
</para>
</note>
Questo secondo esempio mostra come stampare un indirizzo convertito, usando la
funzione <function>printf</function>:
<example>
<title>Visualizzazione di un indirizzo IP</title>
<programlisting role="php">
<![CDATA[
<?php
$ip = gethostbyname("www.php.net");
printf("%u\n", ip2long($ip));
echo $out;
?>
]]>
</programlisting>
</example>
</para>
<para>
Vedere anche: <function>long2ip</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
-->