I'm working with array in PHP. My question is how to access PHP array values outside the for loop.
Here is the code.
<?php
$a = array("1","2");
for($i=0;$i<count($a);$i++){
#some core functionality DB related.
$val = $row['values'];
$b = explode(',',$val);
}
print_r($b);
$fin = array_combine($a,$b);
print_r($fin);
?>
I want to combine both the array, but I'm not getting array b. How to access the array values outside for loop?
Expected output:
Array ( [0] => 7 [1] => 6 ) // b array
Array ( [1] => 7 [2] => 6 ) // fin array