resourcebundle_arrayaccess.phpt 976 B

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