PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $url = "https://restcountries.com/v3.1/all"; $data = file_get_contents($url); $json = json_decode($data, true); $x = 1; foreach($json as $v){ if(isset($v['capital'])){ if(is_array($v['capital'])){ foreach($v['capital'] as $d){ if (mb_substr($d, 0, 1) === "A") echo $x." - ".$d."\n"; $x ++; } } } } #print_r($v);
Show:  
Copy Clear