skip to Main Content

PHP how to join or combine multiple array

I've problem with combining 2 or more arrays in PHP. for example I've list of arrays like this : $array['item_code'] = ['ITM-001','ITM-002','ITM-003']; $array['price'] = [5000,6000,7000]; $array['qty'] = [3,4,5]; ` how to combine the arrays to be output JSON like this…

VIEW QUESTION

foreach array_combine two array by php

There are two arrays that One is the correct answers and the other is the user's answer. My Php: $i=1; $correct = array('a','d','c','a','b','c'); $user = array('a','c','c','a','c','c'); foreach (array_combine($correct, $user) as $co => $ur) { if($co == $ur) { echo $i.':true…

VIEW QUESTION
Back To Top
Search