Czy ktoś potrafi mi to wyjaśnić?
Kod:
function testJsonCode(&$json)
{
foreach ($treeJson as $tj) {
$tj['geeks'] = "baz"; //ten json nie dodaje sie do tablicy json
}
$treeJson['geeks'] = "baz"; //ten json dodaje sie do tablicy json
}
Wynik po wywołaniu funkcji testJsonCode:
^ array: [▼
0 => array:2 [▼
"id" => 19
"test" => array:6 [▶]
]
1 => array:2 [▶]
"geeks" => "baz"