skip to Main Content

Php versions – Convert array variables to associative array

In PHP, what is quickest way to turn the following array variables: $id = [11,12,13]; $code = ['1234','5678','9012']; $qty = [3,4,5]; $amount = [12.34,23.45,34.56]; Into an array of associative arrays, like the following: [ ['id'=>11,'code'=>'1234','qty'=>3,'amount'=>12.34], ['id'=>12,'code'=>'5678','qty'=>4,'amount'=>23.45], ['id'=>13,'code'=>'9012','qty'=>5,'amount'=>34.56], ] Currently, I'm…

VIEW QUESTION
Back To Top
Search