php-src/ext/standard/tests/strings/sprintf_f.phpt
Antony Dovgal 4d44a5b71d MFH: use BSD licensed implementation of double-to-string utilities instead of LGPL one
this patch also fixes thread safety issues in zend_strtod()
2006-12-06 09:52:51 +00:00

41 lines
791 B
PHP
Executable File

--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"