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