I'm trying to create an array based on the values I retrieve.
I want to create arrays that looks like this:
$array = Array ( [id] => 54, [opts] => CKYM / YMLF / FATO )
$array = Array ( [id] => 34, [opts] => CKYM / PIMN )
But, I don't know how to set the key names when I explode the string.
foreach($subfoo["po"] as $option => $po){
$names = "$option,";
foreach($po as $subpo) {
$names .= $subpo["oa_value"]." / ";
}
$build = explode(",",substr($names.','.$cvalues,0,-3));
echo '<pre>'; print_r($build); echo '</pre>';
}
//The above code outputs the following 2 arrays:
Array
(
[0] => 54
[1] => CKYM / YMLF / FATO
)
Array
(
[0] => 34
[1] => CKYM / PIMN
)