From: Banana Date: Mon, 3 Jan 2022 09:50:16 +0000 (+0100) Subject: an example of paths to array and json X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=483e91e27f737f304d6424500b4081cee32a1599;p=dolphin.git an example of paths to array and json --- diff --git a/single-functions/paths-to-assoc-array.php b/single-functions/paths-to-assoc-array.php new file mode 100644 index 0000000..ac0702e --- /dev/null +++ b/single-functions/paths-to-assoc-array.php @@ -0,0 +1,59 @@ + $value, "children" => array()); + $_w = &$_w[$value]["children"]; + } + else { + $_w = &$_w[$value]["children"]; + } + } + + $_w = &$out; + + /* + $count++; + if($count > 10) { + var_dump($out); + exit(); + } + */ + } + fclose($handle); +} else { + // error opening the file. + echo "error opening the file"; +} + +//var_dump($out); +file_put_contents("out.json", json_encode($out, JSON_PRETTY_PRINT));