1--TEST-- 2Test printf() 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 printf() : 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 22echo "\n-- Calling printf() with no arguments --\n"; 23$result = printf($format); 24echo "\n"; 25var_dump($result); 26 27echo "\n-- Calling printf() with one arguments --\n"; 28$result = printf($format1, $arg1); 29echo "\n"; 30var_dump($result); 31 32echo "\n-- Calling printf() with two arguments --\n"; 33$result = printf($format2, $arg1, $arg2); 34echo "\n"; 35var_dump($result); 36 37echo "\n-- Calling printf() with three arguments --\n"; 38$result = printf($format3, $arg1, $arg2, $arg3); 39echo "\n"; 40var_dump($result); 41 42?> 43--EXPECT-- 44*** Testing printf() : basic functionality - using octal format *** 45 46-- Calling printf() with no arguments -- 47format 48int(6) 49 50-- Calling printf() with one arguments -- 5121 52int(2) 53 54-- Calling printf() with two arguments -- 5521 37777777431 56int(14) 57 58-- Calling printf() with three arguments -- 5921 37777777431 567 60int(18) 61