1--TEST--
2Test mb_substr_count() function : error conditions - pass unknown encoding
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7/*
8 * Test behaviour of mb_substr_count() function when passed an unknown encoding
9 */
10
11echo "*** Testing mb_substr_count() : error conditions ***\n";
12
13$haystack = 'Hello, World!';
14$needle = 'Hello';
15$encoding = 'unknown-encoding';
16
17echo "\n-- Testing mb_substr_count() function with an unknown encoding --\n";
18
19try {
20    var_dump(mb_substr_count($haystack, $needle, $encoding));
21} catch (\ValueError $e) {
22    echo $e->getMessage() . \PHP_EOL;
23}
24
25?>
26--EXPECT--
27*** Testing mb_substr_count() : error conditions ***
28
29-- Testing mb_substr_count() function with an unknown encoding --
30mb_substr_count(): Argument #3 ($encoding) must be a valid encoding, "unknown-encoding" given
31