$data = ['abcd', 'ddd']; $data = mb_convert_encoding($data, 'utf-8', 'windows-1251');
I get warning: mb_convert_encoding() expects parameter 1 to be string, array given.
But according to php.net mb_convert_encoding() accepts array. See https://www.php.net/manual/en/function.mb-convert-encoding.php
mb_convert_encoding ( mixed $val , string $to_encoding [, mixed $from_encoding = mb_internal_encoding() ] ) : mixed
Converts the character encoding of val to to_encoding from optionally from_encoding. If val is an array, all its string values will be converted recursively.
Is documentation incorrect or am I stupid?
Advertisement
Answer
As the changelog from the documentation you mentioned describes:
7.2.0 – This function now also accepts an array as val. Formerly, only strings have been supported.
So it is going to work only for PHP in version 7.2.0 and above.