Skip to content

Instantly share code, notes, and snippets.

@binarykore
Last active May 24, 2022 06:25
Show Gist options
  • Select an option

  • Save binarykore/fe83469201b5f01b365a6cf8931dd39b to your computer and use it in GitHub Desktop.

Select an option

Save binarykore/fe83469201b5f01b365a6cf8931dd39b to your computer and use it in GitHub Desktop.
Array Brackets with JSON Pretty Printing method...
<?php
Header("Content-Type:Application/JSON");
$_hash = [
"id" => "world"
];
$_data = [
"hello" => [
$_hash
]
];
print_r(json_encode($_data,JSON_PRETTY_PRINT));
echo("\r\n");
echo("\r\n");
echo($_data["hello"][0]["id"]);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment