Description
int
ip2long
( string ip_address)
ip2long(
)
génère
une
adresse
IPv4
à
partir
de
son
équivalent
numérique
.
Exemple
1
.
Exemple
ip2long(
)
?php
$ip
=
gethostbyname(
"www.php.net")
;
$out
=
"Les
URLS
suivantes
sont
équivalentes
:
br
\n"
;
$out
.=
"http
:
/
/www.php.net
/
,
http
:
/
/".$ip
."
/
,
et
http
:
/
/".ip2long($ip)
."
/
br
\n"
;
echo
$out
;
?
|
|
Ce
second
exemple
montre
comment
afficher
une
adresse
convertie
à
l'
aide
de
la
fonction
printf(
)
:
Exemple
2
.
Affichage
d
'
adresse
IP
?php
$ip
=
gethostbyname(
"www.php.net")
;
printf
("%u\n"
,
ip2long
($ip))
;
echo
$out
;
?
|
|
Voir
aussi
long2ip(
)