mirror of
https://github.com/php/php-src.git
synced 2025-01-09 04:24:06 +08:00
34 lines
812 B
PHP
34 lines
812 B
PHP
--TEST--
|
|
Test vsprintf() function : basic functionality - string format
|
|
--FILE--
|
|
<?php
|
|
/* Prototype : string vsprintf(string $format , array $args)
|
|
* Description: Return a formatted string
|
|
* Source code: ext/standard/formatted_print.c
|
|
*/
|
|
|
|
echo "*** Testing vsprintf() : basic functionality - using string format ***\n";
|
|
|
|
// Initialise all required variables
|
|
$format = "format";
|
|
$format1 = "%s";
|
|
$format2 = "%s %s";
|
|
$format3 = "%s %s %s";
|
|
$arg1 = array("one");
|
|
$arg2 = array("one","two");
|
|
$arg3 = array("one","two","three");
|
|
|
|
|
|
var_dump( vsprintf($format1,$arg1) );
|
|
var_dump( vsprintf($format2,$arg2) );
|
|
var_dump( vsprintf($format3,$arg3) );
|
|
|
|
echo "Done";
|
|
?>
|
|
--EXPECTF--
|
|
*** Testing vsprintf() : basic functionality - using string format ***
|
|
string(3) "one"
|
|
string(7) "one two"
|
|
string(13) "one two three"
|
|
Done
|