| 1 |
lars |
1 |
<?php
|
|
|
2 |
//
|
|
|
3 |
//
|
|
|
4 |
//
|
|
|
5 |
|
|
|
6 |
ini_set('include_path',ini_get('include_path').':../..');
|
|
|
7 |
|
|
|
8 |
require_once 'I18N/Number.php';
|
|
|
9 |
|
|
|
10 |
$locales = array('de_DE','en_US','fr_FR','it_IT');
|
|
|
11 |
|
|
|
12 |
foreach( $locales as $aLocale )
|
|
|
13 |
{
|
|
|
14 |
$number = new I18N_Number( $aLocale );
|
|
|
15 |
|
|
|
16 |
myPrint("<h1>\$number = new I18N_Number( '$aLocale' );</h1>");
|
|
|
17 |
|
|
|
18 |
//
|
|
|
19 |
//
|
|
|
20 |
//
|
|
|
21 |
myPrint( $number->format( pi() ) );
|
|
|
22 |
myPrint( $number->format( 1000000 ) );
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
$number->setFormat(I18N_NUMBER_INTEGER);
|
|
|
26 |
myPrint( $number->format( pi() ) );
|
|
|
27 |
myPrint( $number->format( 100000.99 ) );
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
// set some sencesless format, which has
|
|
|
31 |
// 4 - digits behind the decimal seperator
|
|
|
32 |
// ; - as the decimal seperator
|
|
|
33 |
// : - as the thousands seperator
|
|
|
34 |
$myFormat = $number->setFormat(array( 4 , ';' , ':' ));
|
|
|
35 |
myPrint( $number->format( pi() ) );
|
|
|
36 |
myPrint( $number->format( 1000000.99 ) );
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
// using all currently available formats, including myFormat, which we defined above
|
|
|
40 |
myPrint( $number->format( pi() , I18N_NUMBER_INTEGER ) );
|
|
|
41 |
myPrint( $number->format( pi() , I18N_NUMBER_FLOAT ) );
|
|
|
42 |
myPrint( $number->format( pi() , $myFormat ) );
|
|
|
43 |
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
function myPrint( $string )
|
|
|
50 |
{
|
|
|
51 |
print "$string<br>";
|
|
|
52 |
}
|
|
|
53 |
?>
|