I want to add an additional value into an array before passing it to json_encode function, but I can t get the syntax right.
$result = db_query($query);
// $row is a database query result resource
while ($row = db_fetch_object($result)) {
$stack[] = $row;
// I am trying to inject array element here
$stack[][ x ] = "test";
}
echo json_encode($stack);