File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
strings /
sprintf_f.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
sprintf %f
--FILE--
<?php
var_dump(sprintf("%3.2f", 1.2));
var_dump(sprintf("%-3.2f", 1.2));
var_dump(sprintf("%03.2f", 1.2));
var_dump(sprintf("%-03.2f", 1.2));
echo "\n";
var_dump(sprintf("%5.2f", 3.4));
var_dump(sprintf("%-5.2f", 3.4));
var_dump(sprintf("%05.2f", 3.4));
var_dump(sprintf("%-05.2f", 3.4));
echo "\n";
var_dump(sprintf("%7.2f", -5.6));
var_dump(sprintf("%-7.2f", -5.6));
var_dump(sprintf("%07.2f", -5.6));
var_dump(sprintf("%-07.2f", -5.6));
echo "\n";
var_dump(sprintf("%3.4f", 1.2345678e99));
?>
--EXPECTF--
string(4) "1.20"
string(4) "1.20"
string(4) "1.20"
string(4) "1.20"
string(5) " 3.40"
string(5) "3.40 "
string(5) "03.40"
string(5) "3.400"
string(7) " -5.60"
string(7) "-5.60 "
string(7) "-005.60"
string(7) "-5.6000"
string(105) "1234567%d.0000"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>