php8.5
Home/ Manual/ intl / resourcebundle/ ResourceBundle::getErrorCode

ResourceBundle::getErrorCode

PHP function Edit on GitHub ✎

(PHP 5 >= 5.3.2, PHP 7, PHP 8, PECL intl >= 2.0.0)

Get bundle's last error code

Description

Oop

ResourceBundle::getErrorCode(): int

Procedural

resourcebundle_get_error_code(ResourceBundle $bundle): int

Get error code from the last function performed by the bundle object.

Parameters

bundle

ResourceBundle object.

Return Values

Returns error code from last bundle object call.

Examples

resourcebundle_get_error_code() example

php
<?php
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
echo $r['somestring'];
if(intl_is_failure(resourcebundle_get_error_code($r))) {
    report_error("Bundle error");
}
?>

OO example

php
<?php
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
echo $r['somestring'];
if(intl_is_failure(ResourceBundle::getErrorCode($r))) {
    report_error("Bundle error");
}
?>

See Also

Source: reference/intl/resourcebundle/get-error-code.xml · from the official PHP manual (php/doc-en)