problems with array conversation within global variables

Viewed 30

i want to convert an php multidimensional array with $GLOBAL["x"]...["name"] variable in an json array without loosing the $GLOBAL["x"]...["name"] keyword in it. problem is, if i convert the hole array to an json array to write it in the file, i get the name of the $GLOBAL["x"]...["name"] variable and thats not what i want, because if i change the $GLOBAL["x"]...["name"] variable to another string then the old information is stored in the file and i get the problem to find it. did you have any hints how i could solve it? Also alternative ways would be welcome. thx

example how it is:

$GLOBALS["y"] = [
  ["nr"=>0,"datum"=>"2007-03-12","werte"=>[
    ["nr"=>0,"name"=>$GLOBALS["x"]["b"][8]["name"],"wert"=>"0.6"],
    ...
  ]
]; 

after json conversion i get the string for the file in that form:

[{"nr":0,"datum":"2007-03-12","werte":[{"nr":0,"name":"Name which could be changed","wert":"0.6"},...]}]

nearly example what i want:

[{"nr":0,"datum":"2007-03-12","werte":[{"nr":0,"name":'$GLOBALS["x"]["b"][8]["name"]',"wert":"0.6"},...]}]
0 Answers
Related