PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $playersCount = 16; $totalRounds = ceil(log($playersCount, 2)); $key = 0; $bracket = array(); for($i = 1; $i <= $totalRounds; $i++) { $round = $i; $roundTitle = 'Round ' . $round; $currentRoundPlayers = $playersCount / pow(2, $round - 1); $noOfMatches = $currentRoundPlayers / 2; echo 'Round : ' . $round . ' | Matches : ' . $noOfMatches . '<br />'; $bracket[$key] = array( 'round_title' => $roundTitle, 'round' => $round, ); //Create Empty Slots For Bracket $bracket[$key]['bracketData'][] = array( 'groupID' => '', 'player_1_ID' => '', "name_1" => '', 'class_1' => '', 'img_src_1' => 'assets/uploads/users/default.jpg', 'score_1' => '', 'player_2_ID' => '', "name_2" => '', 'class_2' => '', 'img_src_2' => 'assets/uploads/users/default.jpg', 'score_2' => '' ); $key++; } echo "<pre>"; print_r($bracket); echo "</pre>";
Show:  
Copy Clear