Answers for "encode an array containing non-utf values"

0

encode an array containing non-utf values

Note that if you try to encode an array containing non-utf values, you'll get null values in the resulting JSON string.  You can batch-encode all the elements of an array with the array_map function:
<?php
$encodedArray = array_map(utf8_encode, $rawArray);
?>
Posted by: Guest on April-19-2021

Browse Popular Code Answers by Language