import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / sprintf_variation34.php
blob928904975cb5c047037219a3200731642af601b9
1 <?php
2 /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
3 * Description: Return a formatted string
4 * Source code: ext/standard/formatted_print.c
5 */
7 echo "*** Testing sprintf() : hexa formats with integer values ***\n";
9 // array of integer values
10 $integer_values = array(
13 -1,
14 -2147483648, // max negative integer value
15 -2147483647,
16 2147483647, // max positive integer value
17 2147483640,
18 0x123B, // integer as hexadecimal
19 0x12ab,
20 0Xfff,
21 0XFA,
22 -0x80000000, // max negative integer as hexadecimal
23 0x7fffffff, // max postive integer as hexadecimal
24 0x7FFFFFFF, // max postive integer as hexadecimal
25 0123, // integer as octal
26 01912, // should be quivalent to octal 1
27 -020000000000, // max negative integer as octal
28 017777777777 // max positive integer as octal
31 // array of hexa formats
32 $hexa_formats = array(
33 "%x", "%xx", "%lx",
34 "%Lx", " %x", "%x ",
35 "\t%x", "\n%x", "%4x",
36 "%30x", "%[0-9A-Fa-f]", "%*x"
39 $count = 1;
40 foreach($integer_values as $integer_value) {
41 echo "\n-- Iteration $count --\n";
43 foreach($hexa_formats as $format) {
44 var_dump( sprintf($format, $integer_value) );
46 $count++;
49 echo "Done";