PHP | intl_is_failure() Function
Last Updated :
18 May, 2019
The intl_is_failure() function is an inbuilt function in PHP which is used to check whether the given error code indicates failure.
Syntax:
bool intl_is_failure( $error_code )
Parameters: This function accepts single parameter $error_code which is a value that returned by the functions intl_get_error_code(), collator_get_error_code().
Return Value: If the code indicates some failure then it returns True and in case of success or a warning it returns False.
Below programs illustrate the intl_is_failure() function in PHP:
Program 1:
<?php
function check( $err_code ) {
var_export( intl_is_failure( $err_code ) );
echo "\n" ;
}
check( U_USING_FALLBACK_WARNING );
check( U_ILLEGAL_ARGUMENT_ERROR );
?>
|
Program 2:
<?php
function check( $err_code ) {
var_export( intl_is_failure( $err_code ) );
echo "\n" ;
}
$arr = array (
U_ZERO_ERROR,
U_ILLEGAL_ARGUMENT_ERROR,
U_USING_FALLBACK_WARNING,
);
foreach ( $arr as $err ) {
check( $err );
}
?>
|
Reference: https://www.php.net/manual/en/function.intl-is-failure.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...