I have code that manipulates very large amounts of data and transforms them with json_encode, (about 255’000 characters) and transforms them with json_encode but I notice that each time json_encode does not return more than 3 backslashes, is is this on purpose, a bug, or something else?
<?php
header("content-type: application/json");
function Json_Zip($dir, $data) {
if ($dh = opendir($dir)) {
while (($entry2 = readdir($dh)) !== false) {
if ($entry2 != "." && $entry2 != "..") {
$entry2 = $dir . $entry2;
if (is_dir($entry2)) {
$data[$entry2] = 0;
$data = Json_Zip($entry2."/", $data);
} else {
$fileContent = file_get_contents($entry2);
$data[$entry2] = $fileContent;
}
}
}
}
return $data;
}
file_put_contents("content.json",json_encode(Json_Zip("./", []), JSON_UNESCAPED_UNICODE));
and when I use a script for transform the file to a directory that’s happend :
(At start : “hercher “Nom : Le mei”)
(After json_encode : “hercher “Nom : Le mei”),
I try to update the php version put, nothing