From f374e81b3e5639c1420d96f75ed8aead767b3635 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 8 Nov 2023 20:01:42 +0100 Subject: [PATCH] datas --- demo.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/demo.php b/demo.php index bb1d681..c8dbcf3 100644 --- a/demo.php +++ b/demo.php @@ -13,8 +13,8 @@ $dataPoints = array( ?> format('m-d'); // Month-Day format - // Add to dataPoints - $dataPoints[] = array( + // Initialize player array if not existing + if (!isset($dataPointsPerPlayer[$playername])) { + $dataPointsPerPlayer[$playername] = []; + } + + // Add to dataPoints for this player + $dataPointsPerPlayer[$playername][] = array( "y" => $jsonArray['winplace'], "label" => $label ); @@ -47,11 +54,19 @@ if ($handle = opendir($directory)) { closedir($handle); } -// Output the array -print_r($dataPoints); +// Now, $dataPointsPerPlayer is an array that contains an array of data points for each player +// You can access the data for a specific player like this: +// $playerData = $dataPointsPerPlayer['Lanta01']; + +// Output the array for debugging purposes +echo '
';
+print_r($dataPointsPerPlayer);
+echo '
'; + ?> +