1--TEST-- 2Test sprintf() function : basic functionality - float format 3--FILE-- 4<?php 5echo "*** Testing sprintf() : basic functionality - using float format ***\n"; 6 7 8// Initialise all required variables 9 10$format = "format"; 11$format1 = "%f"; 12$format2 = "%f %f"; 13$format3 = "%f %f %f"; 14 15$format11 = "%F"; 16$format22 = "%F %F"; 17$format33 = "%F %F %F"; 18$arg1 = 11.11; 19$arg2 = 22.22; 20$arg3 = 33.33; 21 22// Calling sprintf() with default arguments 23var_dump( sprintf($format) ); 24 25// Calling sprintf() with two arguments 26var_dump( sprintf($format1, $arg1) ); 27var_dump( sprintf($format11, $arg1) ); 28 29// Calling sprintf() with three arguments 30var_dump( sprintf($format2, $arg1, $arg2) ); 31var_dump( sprintf($format22, $arg1, $arg2) ); 32 33// Calling sprintf() with four arguments 34var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); 35var_dump( sprintf($format33, $arg1, $arg2, $arg3) ); 36 37echo "Done"; 38?> 39--EXPECT-- 40*** Testing sprintf() : basic functionality - using float format *** 41string(6) "format" 42string(9) "11.110000" 43string(9) "11.110000" 44string(19) "11.110000 22.220000" 45string(19) "11.110000 22.220000" 46string(29) "11.110000 22.220000 33.330000" 47string(29) "11.110000 22.220000 33.330000" 48Done 49