1--TEST-- 2Test mb_strrichr() function : error conditions 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strrichr') or die("skip mb_strrichr() is not available in this build"); 7?> 8--FILE-- 9<?php 10echo "*** Testing mb_strrichr() : error conditions ***\n"; 11 12 13echo "\n-- Testing mb_strrichr() with unknown encoding --\n"; 14$haystack = 'Hello, world'; 15$needle = 'world'; 16$encoding = 'unknown-encoding'; 17$part = true; 18 19try { 20 var_dump( mb_strrichr($haystack, $needle, $part, $encoding) ); 21} catch (\ValueError $e) { 22 echo $e->getMessage() . \PHP_EOL; 23} 24 25?> 26--EXPECT-- 27*** Testing mb_strrichr() : error conditions *** 28 29-- Testing mb_strrichr() with unknown encoding -- 30mb_strrichr(): Argument #4 ($encoding) must be a valid encoding, "unknown-encoding" given 31