From 3aa6ac4dd0001157f17126fc27a99436d8565a74 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 29 Sep 2023 14:28:50 +0200 Subject: [PATCH] s --- last_stats.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/last_stats.php b/last_stats.php index cabb9eb..3de741c 100644 --- a/last_stats.php +++ b/last_stats.php @@ -28,7 +28,7 @@ error_reporting(E_ALL); $players_matches = json_decode(file_get_contents('./data/player_last_stats.json'), true); - foreach ($players_matches as $player_datas) { + foreach ($players_matches as $key => $player_datas) { echo ""; echo " @@ -43,7 +43,7 @@ error_reporting(E_ALL); if (!isset($player_data['playername']) || is_null($player_data['playername'])) { continue; // Skip this iteration and move to the next } - // if ($player_data['matches'] == 0) { + // if ($player_data['matches'] == 0) { // continue; //} $player_name = $player_data['playername']; @@ -56,14 +56,20 @@ error_reporting(E_ALL); ? "null" : ($player_data['KD_H'] == "Infinity" ? "∞" - : number_format($player_data['KD_H'], 2, ',', '')); + : (is_numeric($player_data['KD_H']) + ? number_format((float) $player_data['KD_H'], 2, ',', '') + : "Invalid Value")); // or any other default string for non-numerical values + $KD_ALL = !isset($player_data['KD_ALL']) || $player_data['KD_ALL'] === null ? "null" : ($player_data['KD_ALL'] == "Infinity" ? "∞" - : number_format($player_data['KD_ALL'], 2, ',', '')); + : (is_numeric($player_data['KD_ALL']) + ? number_format((float) $player_data['KD_ALL'], 2, ',', '') + : "Invalid Value")); // or any other default string for non-numerical values + echo "
Playername