source: branches/version-2_11-dev/data/module/Compat/tests/function/inet_ntop.phpt @ 20119

Revision 20119, 913 bytes checked in by nanasess, 15 years ago (diff)

module 以下は svn:keywords を除外

  • Property svn:eol-style set to LF
Line 
1--TEST--
2Function -- inet_ntop
3--SKIPIF--
4<?php if (function_exists('inet_ntop')) { echo 'skip'; } ?>
5--FILE--
6<?php
7require_once 'PHP/Compat.php';
8PHP_Compat::loadFunction('inet_ntop');
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
18foreach ($adds as $k => $v) {
19    echo "\ntesting: $k\n    ";
20    var_dump(inet_ntop(pack('H*', $v)));
21}
22
23?>
24--EXPECT--
25testing: 127.0.0.1
26    string(9) "127.0.0.1"
27
28testing: 192.232.131.222
29    string(15) "192.232.131.222"
30
31testing: ::1
32    string(3) "::1"
33
34testing: 2001:260:0:10::1
35    string(16) "2001:260:0:10::1"
36
37testing: fe80::200:4cff:fe43:172f
38    string(24) "fe80::200:4cff:fe43:172f"
Note: See TracBrowser for help on using the repository browser.