1--TEST-- 2Test ResourceBundle array access and count - existing/missing keys 3--EXTENSIONS-- 4intl 5--FILE-- 6<?php 7 include "resourcebundle.inc"; 8 9 // fall back 10 $r = new ResourceBundle( 'en_US', BUNDLE ); 11 12 printf( "length: %d\n", count($r) ); 13 printf( "teststring: %s\n", $r['teststring'] ); 14 printf( "testint: %d\n", $r['testint'] ); 15 16 print_r( $r['testvector'] ); 17 18 printf( "testbin: %s\n", bin2hex($r['testbin']) ); 19 20 $r2 = $r['testtable']; 21 printf( "testtable: %d\n", $r2['major'] ); 22 23 $r2 = $r['testarray']; 24 printf( "testarray: %s\n", $r2[2] ); 25 26 echo "Using a reference as an offset:\n"; 27 $offset = 'teststring'; 28 $ref = &$offset; 29 var_dump($r[$ref]); 30 31 $t = $r['nonexisting']; 32 echo debug( $t ); 33?> 34--EXPECT-- 35length: 6 36teststring: Hello World! 37testint: 2 38Array 39( 40 [0] => 1 41 [1] => 2 42 [2] => 3 43 [3] => 4 44 [4] => 5 45 [5] => 6 46 [6] => 7 47 [7] => 8 48 [8] => 9 49 [9] => 0 50) 51testbin: a1b2c3d4e5f67890 52testtable: 3 53testarray: string 3 54Using a reference as an offset: 55string(12) "Hello World!" 56NULL 57 2: Cannot load resource element 'nonexisting': U_MISSING_RESOURCE_ERROR 58