Skip to content
Advertisement

Tag: array-push

Pushing a sub array into the same array

I am trying to put content of one array into the same array. Here I have an array $mclass with values such as You can see I have room_id index with 1,3,5 value. Now, I want to explode the room_id and get duplicate of same array index data with change of room_id and push into the array. and finally delete

array_push is replacing the variables instead of adding them to the end

Does anyone see an issue? Array push is just replacing variables instead of adding them. The variables of $fname, $lname, and $gender are defined by the user in a form. I want the variables to simply be added to the end of the array instead of being replaced. Any responses are appreciated. Answer if $info[“First_Names”] ,$info[“Last_Names”] ,$info[“Gender”] are arrays ,I

Advertisement