Skip to content

I duplicated code and got different output

Got a weird one here. I’m just going to give snippets, they talk for themselves. I just want to know what is going on. Controller: $marketingData = DB::table(‘marketing’)->orderBy(‘isActive’,’desc’)…

array_push replacing value instead of adding new value in array

I’m trying to make a cart system, which is I need to sum all total product. I’m thinking about saving the total to an array, so I can use array_sum it later. But somehow the array $total_cart[] only have last total, for example is if I have three product in my cart, the total saved in the array is…