I am creating an array inside a foreach loop. The array consists of the values that i am fetching from google play store. What i want to do is combine the different arrays to a single dimensional array. The outer arrays doesn't have keys. How can i combine all the sub arrays without a key.The result that i showed is same array not different arrays so this question is different. Please help me. Thanks in advance.
php function for fetching values
function gplaystore_get_single_product_card_link($link){
$final_array=array();
$html = file_get_contents($link);
$gplay_doc = new DOMDocument();
libxml_use_internal_errors(TRUE);
if(!empty($html)){
$gplay_doc->loadHTML($html);
libxml_clear_errors();
$gplay_xpath = new DOMXPath($gplay_doc);
$gplay_row = $gplay_xpath->query('//a[@class="card-click-target"]/@href');
if($gplay_row->length > 0){
foreach($gplay_row as $key=>$val){
$final_array[] = 'https://play.google.com'.$val->nodeValue;
}
}
}
echo '<pre>';
print_r($final_array);
echo '</pre>';
}
result i am getting
Array
(
[0] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[1] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[2] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[3] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[4] => https://play.google.com/store/apps/details?id=codeadore.textgram
}
Array
(
[0] => https://play.google.com/store/apps/details?id=com.autoscout24
[1] => https://play.google.com/store/apps/details?id=com.autoscout24
[2] => https://play.google.com/store/apps/details?id=com.autoscout24
[3] => https://play.google.com/store/apps/details?id=com.autoscout24
[4] => https://play.google.com/store/apps/details?id=ru.gibdd_pay.app
[5] => https://play.google.com/store/apps/details?id=ru.gibdd_pay.app
}
Array
(
[0] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[1] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[2] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[3] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[4] => https://play.google.com/store/apps/details?id=in.letstartup.GoraTips
[5] => https://play.google.com/store/apps/details?id=in.letstartup.GoraTips
}
the actual result that i want
Array
(
[0] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[1] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[2] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[3] => https://play.google.com/store/apps/details?id=com.depthapps.stylish.name.maker
[4] => https://play.google.com/store/apps/details?id=codeadore.textgram
[5] => https://play.google.com/store/apps/details?id=com.autoscout24
[6] => https://play.google.com/store/apps/details?id=com.autoscout24
[7] => https://play.google.com/store/apps/details?id=com.autoscout24
[8] => https://play.google.com/store/apps/details?id=com.autoscout24
[9] => https://play.google.com/store/apps/details?id=ru.gibdd_pay.app
[10] => https://play.google.com/store/apps/details?id=ru.gibdd_pay.app
[11] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[12] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[13] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[14] => https://play.google.com/store/apps/details?id=com.northpark.beautycamera
[15] => https://play.google.com/store/apps/details?id=in.letstartup.GoraTips
[16] => https://play.google.com/store/apps/details?id=in.letstartup.GoraTips
}