1--TEST--
2Test base_convert() - see https://wiki.php.net/rfc/base_convert_improvements
3--FILE--
4<?php
5echo base_convert('FF', 16, 10) . "\n";
6echo base_convert('20', 8, 10) . "\n";
7echo base_convert('0xFf', 16, 10) . "\n";
8echo base_convert('0FF', 16, 10) . "\n";
9echo base_convert(" 0xFF\t\n" , 16, 10) . "\n";
10echo base_convert(" 0xFF\t\n" , 16, 10) . "\n";
11echo base_convert("\r\nFF\t\n" , 16, 10) . "\n";
12echo base_convert("0o7" , 8, 10) . "\n";
13echo base_convert("0b1010" , 2, 10) . "\n";
14
15echo "=======================================";
16
17// These should fail
18echo base_convert('fg', 16, 10);
19echo base_convert('f 0xff ', 16, 10);
20echo base_convert('1xff ', 16, 10);
21echo base_convert(chr(0), 16, 10);
22echo base_convert("0o7" , 9, 10);
23echo base_convert("0 0" , 9, 10) . "\n";
24?>
25--EXPECTF--
26255
2716
28255
29255
30255
31255
32255
337
3410
35=======================================
36Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
3715
38Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
3961695
40Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
41511
42Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
430
44Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
457
46Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
470
48