Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Function -- inet_pton
3
--SKIPIF--
4
<?php if (function_exists('inet_pton')) { echo 'skip'; } ?>
5
--FILE--
6
<?php
7
require_once 'PHP/Compat.php';
8
PHP_Compat::loadFunction('inet_pton');
9
 
10
$adds = array(
11
    '127.0.0.1'                  => '7f000001',
12
    '192.232.131.222'            => 'c0e883de',
13
    '::1'                        => '00000000000000000000000000000001',
14
    '2001:260:0:10::1'           => '20010260000000100000000000000001',
15
    'fe80::200:4cff:fe43:172f'   => 'fe8000000000000002004cfffe43172f'
16
);
17
 
18
foreach ($adds as $k => $v) {
19
    echo "\ntesting: $k\n    ";
20
    echo bin2hex(inet_pton($k)), "\n";
21
}
22
 
23
?>
24
--EXPECT--
25
testing: 127.0.0.1
26
    7f000001
27
 
28
testing: 192.232.131.222
29
    c0e883de
30
 
31
testing: ::1
32
    00000000000000000000000000000001
33
 
34
testing: 2001:260:0:10::1
35
    20010260000000100000000000000001
36
 
37
testing: fe80::200:4cff:fe43:172f
38
    fe8000000000000002004cfffe43172f