I have a php array created according to the format I wish to insert into a javascript array variable. My php array values are currently :
Array ( [0] => "Butter noob", 26375 [1] => "Crab Vermecilli", 0 [2] => "Salted Egg Yolk Crab", 0 )
Now , i need this array to replace the values within the javascript function code snippet below :
series: [{
name: 'Delivered amount',
data: [
['Bananas', 8],
['Kiwi', 3],
['Mixed nuts', 1],
['Oranges', 6],
['Apples', 8],
['Pears', 4],
["Clementines", 4],
['Reddish (bag)', 1],
['Grapes (bunch)', 1]
]
}]
So after including my converted php array into the javascript function, it should look something like :
series: [{
name: 'Delivered amount',
data: [
["Butter Noob", 26375],
["Crab Vermecelli", 0],
["Salted Egg Yolk Crab", 0],
]
}]
Can anyone assist me on this matter? I tried json_encode but im stucked now. How do i use converted php array with json_encode under such situation ?