";
echo "
compare | ";
echo "" . escape_html($locale) . " | ";
echo "" . escape_html($num) . " | ";
echo "" . escape_html($style) . " | ";
$php_format= $php_formatter->format($num);
$mrbs_format = $mrbs_formatter->format($num);
echo "$php_format | ";
echo "$mrbs_format | ";
// Compare the results
$passed = ($php_format === $mrbs_format);
$color = ($passed) ? $color_pass : $color_fail;
echo '';
echo ($passed) ? 'Pass' : 'Fail';
echo " | ";
echo "\n";
}
function test_format()
{
echo "Testing format()
\n";
echo "\n";
echo thead_html(['locale', 'num', 'style']);
echo "\n";
do_format('en', 1000000, \NumberFormatter::DEFAULT_STYLE);
do_format('fr', 1000000, \NumberFormatter::DEFAULT_STYLE);
do_format('de', 1000000, \NumberFormatter::DEFAULT_STYLE);
echo "\n";
echo "
\n";
}
$loaded_extensions = get_loaded_extensions();
echo "PHP version: " . PHP_VERSION;
echo "
\n";
echo "mbstring enabled: " . var_export(in_array('mbstring', $loaded_extensions), true);
echo "
\n";
echo "intl enabled: " . var_export(in_array('intl', $loaded_extensions), true);
echo "
\n";
echo "
\n";
if (!in_array('intl', $loaded_extensions))
{
die("This test needs the 'intl' PHP extension to be loaded.");
}
test_constants('NumberFormatter');
test_format();