Unable to add to array - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Unable to add to array (/showthread.php?tid=82133) |
Unable to add to array - Sincere - 06-15-2022 I've done this many times before: adding an array to an yet already existing array, but for some reason this isn't working now, and I'm out of clues: PHP Code: $influx_server_data = []; But for some reason $influx_server_data will only have the array from the first run (health in this case). The first print_r confirms that the foreach works fine and shows the desired array for each run. I'd be grateful for any insights! RE: Unable to add to array - Sincere - 06-15-2022 @kenjis helped solve this: I had to do the following: PHP Code: $influx_server_data[] = [$influx_server_point]; RE: Unable to add to array - InsiteFX - 06-16-2022 PHP Code: $result = array_merge($array1, $array2); |