Skip to content

Tag: foreach

Foreach last item gets methode

Guys I have an array with objects, I want the last item in the foreach loop do something else then the rest. How do I archive that? Answer This will process the array of objects and do something else with the last element:

Reformat json in a correct way

I have this php code as I am trying to execute a particular function in my php project, I code the implementation correct but I ran into a small problem. Running the code above I got this result below, That’s the expected result but I want to omit [] between data But actually I wanted this result Answer…