I would like to know how to compare several elements, in this example I have only four. But in the list I have more than 40. If it were to do one by one, the code would be incomprehensible and subject to great errors ... Can anyone help me how to make a comparison with several variables? Thank you in advance for your help!
$result1 = $result['linha'][0]['elemento'][0]['tempo']['text'];
$result2 = $result['linha'][0]['elemento'][1]['tempo']['text'];
$result3 = $result['linha'][0]['elemento'][2]['tempo']['text'];
$result4 = $result['linha'][0]['elemento'][3]['tempo']['text'];
$endereço1 = "rua alves fiho";
if ($result1 < $result2) {
$result1 = $endereço1;
}