File tree Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 11<?php
22class Autoloader {
3- static public function loader ($ className ) {
4- $ filename = str_replace ("\\" , '/ ' , $ className ) . ".php " ;
5- if (file_exists ($ filename )) {
6- include ($ filename );
7- if (class_exists ($ className )) {
8- return TRUE ;
9- }
10- }
11- return FALSE ;
12- }
3+ static public function loader ($ className ) {
4+ $ filename = str_replace ("\\" , '/ ' , $ className ) . ".php " ;
5+ if (file_exists ($ filename )) {
6+ include ($ filename );
7+ if (class_exists ($ className )) {
8+ return TRUE ;
9+ }
10+ }
11+ return FALSE ;
12+ }
1313}
1414spl_autoload_register ('Autoloader::loader ' );
Original file line number Diff line number Diff line change 77
88class Roulete {
99
10- public function spin ($ items ){
10+ public function spin ($ items ) {
1111
1212 $ max = 0 ;
1313 foreach ($ items as $ key => $ value ) {
1414 $ max += $ value ;
1515 $ items [$ key ] = $ max ;
1616 }
1717
18- $ random = mt_rand (1 ,$ max );
18+ $ random = mt_rand (1 , $ max );
1919
2020 foreach ($ items as $ item => $ max )
2121 {
22- if ($ random <= $ max ){
22+ if ($ random <= $ max ) {
2323 break ;
2424 }
2525 }
Original file line number Diff line number Diff line change 1111 <div class="row">
1212 <div class="col-md-12" align="center">
1313 <div class="alert alert-primary">
14- <?= "<h2>Selamat Kamu mendapatkan </h2><h2> " . Roll::spin (['SSR ITEM ' => 0.1 ,
14+ <?= "<h2>Selamat Kamu mendapatkan </h2><h2> " .Roll::spin (['SSR ITEM ' => 0.1 ,
1515 'SSR ITEM 2 ' => 0.2 ,
1616 'SSR ITEM 3 ' => 0.3 ,
1717 'SSR ITEM 4 ' => 0.4 ,
Original file line number Diff line number Diff line change 22 <div class="row">
33 <div class="col-md-5">
44 <div class="alert alert-primary">
5- <?= "<h2>kamu mendapatkan </h2><h2> " . Roll::spin ()."</h2> " ?>
5+ <?= "<h2>kamu mendapatkan </h2><h2> " .Roll::spin ()."</h2> " ?>
66 </div>
77 </div>
88 </div>
You can’t perform that action at this time.
0 commit comments