= $iDateFrom) { array_push($aryRange, date('Y-m-d', $iDateFrom)); // first entry while ($iDateFrom<$iDateTo) { $iDateFrom += 86400; // add 24 hours array_push($aryRange, date('Y-m-d', $iDateFrom)); } } return $aryRange; } function interval($date1, $date2) { //$date1 = '01-10-2010'; //$date2 = '05-10-2010'; // Declare an empty array $array = array(); // Use strtotime function $variable1 = strtotime($date1); $variable2 = strtotime($date2); // Use for loop to store dates into array // 86400 sec = 24 hrs = 60*60*24 = 1 day for ($currentDate = $variable1; $currentDate <= $variable2; $currentDate += (86400)) { $store = date('Y-m-d', $currentDate); $array[] = $store; } return $array; } function date_formatted($date) { $pieces = explode("-", $date); switch ($pieces[1]) { case 'Jan': $detected_month = "01"; break; case 'Feb': $detected_month = "02"; break; case 'Mar': $detected_month = "03"; break; case 'Apr': $detected_month = "04"; break; case 'May': $detected_month = "05"; break; case 'Jun': $detected_month = "06"; break; case 'Jul': $detected_month = "07"; break; case 'Aug': $detected_month = "08"; break; case 'Sep': $detected_month = "09"; break; case 'Oct': $detected_month = "10"; break; case 'Nov': $detected_month = "11"; break; case 'Dec': $detected_month = "12"; break; } $date_str = $pieces[2] ."-" .$detected_month ."-" .$pieces[0]; return $date_str; } ?>
| ID | Resultat | ELO | Couleur | Adversaire | Date |
| ".$id." " ."W1" ." | ![]() |
".$w_rating. " (" .$w_brating ." " .$diff_w ." )![]() |
White | ".$b_name." ".$b_rating ." (" .$b_brating ." " .$diff_b .") Black ![]() |
".$date_convert." |
| ".$id." " ."W2" ." | ![]() |
".$w_rating. " (" .$w_brating ." " .$diff_w ." )![]() |
White | ".$b_name." ".$b_rating ." (" .$b_brating ." " .$diff_b .") Black ![]() |
".$date_convert." | ".$w_rating. " (" .$w_brating ." " .$diff_w .")![]() | ";
$s2 = "".$b_name." ".$b_rating ." (" .$b_brating ." " .$diff_b .") Black ![]() | ";
}
else
{
$s1 = "".$w_rating. " (" .$w_brating ." " .$diff_w .")![]() | ";
$s2 = "".$b_name." ".$b_rating ." (" .$b_brating ." " .$diff_b .") Black ![]() | ";
}
//$pipo =array( $timestamp, $date_convert , $w_rating);
$pipo = array("aaa"=>$timestamp,"bbb"=>$date_convert,"ccc"=>$w_rating);
echo "
| ".$id." | ![]() | ";
echo $s1;
echo " White | "; echo $s2; echo "".$date." | ||
| ".$id ." " ."B1" ." | ![]() |
".$b_rating. " (" .$b_brating ." " .$diff_b .")![]() |
Black | ".$w_name." ".$w_rating ." (" .$w_brating ." " .$diff_w .") White ![]() |
".$date_convert." |
| ".$id ." " ."B2" ." | ![]() |
".$b_rating. " (" .$b_brating ." " .$diff_b.")![]() |
Black | ".$w_name." ".$w_rating ." (" .$w_brating ." " .$diff_w .") White ![]() |
".$date_convert." | ".$b_rating. " (" .$b_brating ." " .$diff_b .")![]() | ";
$s2 = "".$w_name." ".$w_rating ." (" .$w_brating ." " .$diff_w .") Black ![]() | ";
}
else
{
$s1 = "".$b_rating. " (" .$b_brating ." " .$diff_b .")![]() | ";
$s2 = "".$w_name." ".$w_rating ." (" .$w_brating ." " .$diff_w .") Black ![]() | ";
}
//$pipo =array( $timestamp, $date_convert , $b_rating);
$pipo = array("aaa"=>$timestamp,"bbb"=>$date_convert,"ccc"=>$b_rating);
echo "
| ".$id." | ![]() | ";
echo $s1;
echo " Black | "; echo $s2; echo "".$date." |
"; //print_r($pipo); //echo ""; // 25-Apr-2014 // 13-Mar-2020 //YYYY-MM-DD $tab = createDateRangeArray("2014-04-25","2020-03-13"); //echo "
"; //print_r($tab); //echo ""; /***************************************************************/ //$tab_timestamp = interval("2014-04-25","2020-03-13"); $tab_timestamp = interval( date_formatted($date1), date_formatted($date2)); echo "
"; print_r($tab_timestamp); echo ""; $elo_data = array(); for ($i = 0; $i < count($tab)-1; $i++) { $timestamp = strtotime($tab[$i]); $tmp =array( $timestamp, "val"); $elo_data[] = $tmp; } echo "
"; print_r($elo_data); echo ""; echo "Find ... " .$elo_data[0][0]; // $key = array_search( $elo_data[0][0] ,$graph_data); //$id = searchForId( $elo_data[0][0], $graph_data); $cpt = 1; for ($i = 0; $i < count($elo_data); $i++) { $find_timestamp = $elo_data[$i][0]; $find = 0; for ($j = 0; $j < count($graph_data); $j++) { $key = "aaa"; if( $graph_data[$j][$key] == $find_timestamp) { echo " +++++ " .$cpt . " " .$find_timestamp . " " .$graph_data[$j]["ccc"]; echo "
"; print_r($elo_data); echo ""; $json = json_encode($elo_data); file_put_contents("elo_data.json", $json); //$key = array_search($elo_data[0][0], array_column($graph_data, 'ccc')); // echo " +++++ " .$key; ///// https://stackoverflow.com/questions/6661530/php-multidimensional-array-search-by-value // https://www.geeksforgeeks.org/php-multidimensional-array-search-by-value/ // https://code.tutsplus.com/tutorials/working-with-php-arrays-in-the-right-way--cms-28606 /* for ($i = 0; $i < count($elo_data); $i++) { echo $elo_data[$i][0]; echo "