Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php  
  2. function randomBalance(){
  3.     $balance = rand(10000,150000);
  4.     echo $balance;
  5.     return $balance;
  6. }
  7. function returnGold(){
  8.     $array = array($balance);
  9.     if ( $balance < 100) {return $balance;}
  10.     else { 
  11.             if ($balance < 10000){
  12.                 $copper = $array[count($array) - 1] . $array [count($array) - 2];
  13.                 $silver = $array[count($array) - 3] . $array [count($array) - 4];
  14.                 return $copper, $silver;
  15.  
  16.             }  
  17.             else {
  18.                 $copper = $array[count($array) - 1] . $array [count($array) - 2];
  19.                 $silver = $array[count($array) - 3] . $array [count($array) - 4];
  20.                 for ($i = 4; $i === 0; $i--){
  21.                     unset($array[count($array) - $i]);
  22.                 }
  23.                 for($a = 0; $a == count($array); $a++){
  24.                     $gold  = null;
  25.                     $gold .=  $array[count($array);
  26.                 }
  27.                 return $gold, $copper, $silver;
  28.             }
  29.         }
  30. function echoBalance(){
  31.     $playerBalance  = randomBalance();
  32.     $playerPocket   = array(returnGold($playerBalance));
  33.     for ($i=0; $i === 3;){ 
  34.     echo $playerPocket[$i]"\n";
  35.     }
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement