$a = explode(", ", $g->readby); $b = explode(", ", $g->view_date); $count = 0; for($i=0;$i<count($a);$i++){ foreach($a as $key => $value){ } foreach($b as $kat => $vault){ $array = ($key => $vault); } print_r($array); } PHP: I'm trying to join the two values from each array in to one, could you tell me why I'm doing this wrong and how to fix it? Thanks
Maybe you need this one: $a = explode(", ", $g->readby); $b = explode(", ", $g->view_date); print_r(array_merge($a,$b)); PHP:
What I'm trying to do is get the value of readby and make it equal the value of view_date e.g $array = ($readby => $viewdate) PHP:
Maybe you need this: $a = explode(", ", $g->readby); $b = explode(", ", $g->view_date); $keys = array_keys($a); $values = array_values($b); $array = array_combine($keys,$values); print_r($array); PHP: or this: $a = explode(", ", $g->readby); $b = explode(", ", $g->view_date); $keys = array_values($a); $values = array_values($b); $array = array_combine($keys,$values); print_r($array); PHP: