0
foreach($arrayUsers as $user) {
echo '<tr><td>'. $user['firstname'] .'</td><td>'. $user['lastname'] .'</td><td>'. $currencies[$user["currency"]] . $user['salary']. 
    '</td></tr>';
}
?>

Calling 'salary' from a JSON file, but need this to be rounded to 2 decimal places in the output table.

1 Answers1

1

For rounding numbers you can use the round() and you can mention the precision as well.

round($user['salary'], 2)

You can find more information on round function Here

Hope this helps.

Kishen Nagaraju
  • 2,062
  • 9
  • 17