1--TEST-- 2Test sprintf() function : basic functionality - octal format 3--SKIPIF-- 4<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> 5--FILE-- 6<?php 7/* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) 8 * Description: Return a formatted string 9 * Source code: ext/standard/formatted_print.c 10 */ 11 12echo "*** Testing sprintf() : basic functionality - using octal format ***\n"; 13 14// Initialise all required variables 15$format = "format"; 16$format1 = "%o"; 17$format2 = "%o %o"; 18$format3 = "%o %o %o"; 19$arg1 = 021; 20$arg2 = -0347; 21$arg3 = 0567; 22 23// Calling sprintf() with default arguments 24var_dump( sprintf($format) ); 25 26// Calling sprintf() with two arguments 27var_dump( sprintf($format1, $arg1) ); 28 29// Calling sprintf() with three arguments 30var_dump( sprintf($format2, $arg1, $arg2) ); 31 32// Calling sprintf() with four arguments 33var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); 34 35echo "Done"; 36?> 37--EXPECTF-- 38*** Testing sprintf() : basic functionality - using octal format *** 39string(6) "format" 40string(2) "21" 41string(25) "21 1777777777777777777431" 42string(29) "21 1777777777777777777431 567" 43Done 44