2
Test ResourceBundle::get() and length() - existing/missing keys
5
include "resourcebundle.inc";
10
$r = ut_resourcebundle_create( 'en_US', BUNDLE );
12
$str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) );
13
$str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) );
14
$str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) );
16
$str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true );
18
$str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) );
20
$r2 = ut_resourcebundle_get($r, 'testtable' );
21
$str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) );
23
$r2 = ut_resourcebundle_get($r,'testarray' );
24
$str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) );
26
$t = ut_resourcebundle_get( $r, 'nonexisting' );
27
$str_res .= debug( $t );
31
include_once( 'ut_common.inc' );
36
teststring: Hello World!
51
testbin: a1b2c3d4e5f67890
55
2: Cannot load resource element 'nonexisting': U_MISSING_RESOURCE_ERROR