public function checkGameResult($cards) { $user = new AccountController(); if (isset($cards['stand']) && $cards['playerResult'] <= $cards['dealerResult'] && $cards['dealerResult'] <= 21) { // lose $cards['win'] = 0; $user->updateChips($cards); } elseif (isset($cards['stand']) && $cards['playerResult'] <= 21 && $cards['playerResult'] > $cards['dealerResult']) { // win $cards['win'] = $cards['bet'] * 2; $cards['bankroll'] = $cards['win'] + $cards['bankroll']; $user->updateChips($cards); } elseif (isset($cards['stand']) && $cards['playerResult'] <= 21 && $cards['dealerResult'] > 21) { // win $cards['win'] = $cards['bet'] * 2; $cards['bankroll'] = $cards['win'] + $cards['bankroll']; $user->updateChips($cards); } elseif ($cards['playerResult'] > 21) { // lose $cards['win'] = 0; $user->updateChips($cards); } return $cards; }