1--TEST-- 2Test printf() function : basic functionality - unsigned 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 11/* Prototype : int printf ( string $format [, mixed $args [, mixed $... ]] ) 12 * Description: Produces output according to format . 13 * Source code: ext/standard/formatted_print.c 14 */ 15 16echo "*** Testing printf() : basic functionality - using unsigned format ***\n"; 17 18 19// Initialise all required variables 20$format = "format"; 21$format1 = "%u"; 22$format2 = "%u %u"; 23$format3 = "%u %u %u"; 24$arg1 = -1111; 25$arg2 = -1234567; 26$arg3 = +2345432; 27 28echo "\n-- Calling printf() with no arguments --\n"; 29$result = printf($format); 30echo "\n"; 31var_dump($result); 32 33echo "\n-- Calling printf() with one arguments --\n"; 34$result = printf($format1, $arg1); 35echo "\n"; 36var_dump($result); 37 38echo "\n-- Calling printf() with two arguments --\n"; 39$result = printf($format2, $arg1, $arg2); 40echo "\n"; 41var_dump($result); 42 43echo "\n-- Calling printf() with three arguments --\n"; 44$result = printf($format3, $arg1, $arg2, $arg3); 45echo "\n"; 46var_dump($result); 47 48?> 49===DONE=== 50--EXPECTF-- 51*** Testing printf() : basic functionality - using unsigned format *** 52 53-- Calling printf() with no arguments -- 54format 55int(6) 56 57-- Calling printf() with one arguments -- 584294966185 59int(10) 60 61-- Calling printf() with two arguments -- 624294966185 4293732729 63int(21) 64 65-- Calling printf() with three arguments -- 664294966185 4293732729 2345432 67int(29) 68===DONE=== 69