I am relatively new to php Sorry if I am not asking the question properly. here it goes:
My array:
$value = array(
array('2500'),
array('3000'),
array('3500'),
array('4000')
);
From code:
$Array = array();
for ($i=0; $i<count($value);$i++) {
$Array[]=$value;
}
echo '<pre>';
print_r($Array);
echo '</pre>';
How to merge it into one array like this:
Array
[0] => 2500
[1] => 3000
[2] => 3500
[3] => 4000
)
I've tried a lot of codes from array_merge to array_combine nothing seems to do the trick. Is their something I am missing in the code or is there a function or a filter that can accomplish this.
Try this:
<?php
$value = array(
array('2500'),
array('3000'),
array('3500'),
array('4000')
);
echo '<pre>'; // for display purpose only
print_r($value); // for display purpose only
$array = array();
if (is_array($value)) {
foreach ($value as $v) {
$array = array_merge($array,$v);
}
} else {
$array = array($value);
}
print_r($array); // for display purpose only
EDITED based on OP's update