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