Skip to content
Advertisement

Tag: arrays

Accumulate monthly totals while looping

I have an array of data containing monthly amounts from the current year and the previous year. The previous year always has all of its amounts, but when a current/future month in the current year is iterated it has a null value. Here is an example: This is my current code How can I roll previous month amounts into current

I can’t generate the correct Json file in PHP

it does not work properly please help me to get the correct json file? in particular when I inserted it in the site in php I got this array so the Json file creates it correctly this is the first array I generate via submit of my form. this array I add it to the end of the Json file,

Validating array only integer number in PHP

I want to validate an array so only integer number is allowed. I’ve tried some ways but still doesn’t get the result I want. I have array like this: First I’m writing a code like this: I got an error that said only string allowed for !preg_match function, this is because $total is an array. Next is I’m trying to

concatenate array values ​into string?

I have this array, is stored in a variable called $ data : and i want to add to another variable to send to an API but when i echo $body the result its like this: how can I add the string to have an output like this: thanks to all Answer If you’re using XML, it’s better to learn

Advertisement