1--TEST--
2mb_check_encoding()
3--EXTENSIONS--
4mbstring
5--FILE--
6<?php
7ini_set('default_charset', 'UTF-8');
8// Valid
9$str = "Japanese UTF-8 text. 日本語のUTF-8テキスト";
10$arr = [1234, 12.34, TRUE, FALSE, NULL, $str, 'key'=>$str, $str=>'val'];
11var_dump(mb_check_encoding($str), mb_check_encoding($arr));
12
13// Invalid
14$str = "Japanese UTF-8 text. 日本語\xFE\x01\x02のUTF-8テキスト";
15$arr1 = [1234, 12.34, TRUE, FALSE, NULL, 'key'=>$str, $str=>'val'];
16$arr2 = [1234, 12.34, TRUE, FALSE, NULL, $str=>'val'];
17var_dump(mb_check_encoding($str), mb_check_encoding($arr1),  mb_check_encoding($arr2));
18?>
19--EXPECT--
20bool(true)
21bool(true)
22bool(false)
23bool(false)
24bool(false)
25