Skip to content

Tag: arrays

Organizing array Iteration generated from nested loops PHP

I have a loop that fetches data from an excel file using phpspreadsheet. data fetching has no problem, but what I want to do is organize the data to a multi-dimensional array then convert it to JSON so I can access it through javascript. here’s the code: when I run this code, it shows this text: Now I w…

Array data manipulations PHP

I get from my DB data in format like this: Each of array inside has a key: “id”. It mostly look values from 1 to 3. I would like to create a new array based on this “ids” that would look like this: I`ve been trying to do it like this: And that would work, but it doesn`t look good

Create Json array from mysql data

I need a bit of help, i have this code: which is returning and i need to return like this: Could someone helping me? I search everywhere but i don’t see how to adjust array to get needed structure Answer You’re adding an extra array layer with the []. Change the code to this:

Filter API response with PHP

Not sure what issue was with first pastebin code, here is another attempt. I am connecting to Vimeo Live API, in doing so the response is huge > 500kb in total – I have an example with only one object here -> there are over 20 it returns. I have a better idea of what Im doing in JS than

Getting value of an array inside two arrays

I’m trying to get the value of the array, but I just cant quite get to it. I’m trying with a foreach loop and with key and values. But I can’t get it right. I’m working with wordpress custom field, and I’m trying to retrieve product ID, so that I can manipulate website data. This…