I'm searching an external Json page, for $a and echoing $b.
<?php
$jsonurl = "site.com/json.json";
$json = file_get_contents($jsonurl);
$json_output = json_decode($json);
foreach ($json_output as $page) {
foreach($page->X as $X) {
if (isset($X->a)) {
$a= $x->a;
$b = $x->b;
if ( $a == 'Hello' || $a == 'Hi'){
echo $b
$b is a number, and there could be only one number or perhaps two or three. If there's more than one, what is a tidy way of only echoing the largest value of $b rather than all of them should more than one value exist?
The numbers are unknown so I can't use echo max or something similar.