Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Autoloader.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
class Autoloader {
static public function loader($className) {
$filename = str_replace("\\", '/', $className) . ".php";
if (file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return TRUE;
}
}
return FALSE;
}
static public function loader($className) {
$filename = str_replace("\\", '/', $className) . ".php";
if (file_exists($filename)) {
include($filename);
if (class_exists($className)) {
return TRUE;
}
}
return FALSE;
}
}
spl_autoload_register('Autoloader::loader');
6 changes: 3 additions & 3 deletions Irfa/Roulete.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

class Roulete {

public function spin($items){
public function spin($items) {

$max = 0;
foreach ($items as $key => $value) {
$max += $value;
$items[$key] = $max;
}

$random = mt_rand(1,$max);
$random = mt_rand(1, $max);

foreach ($items as $item => $max)
{
if ($random <= $max){
if ($random <= $max) {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion example.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="row">
<div class="col-md-12" align="center">
<div class="alert alert-primary">
<?= "<h2>Selamat Kamu mendapatkan </h2><h2>". Roll::spin(['SSR ITEM' => 0.1,
<?= "<h2>Selamat Kamu mendapatkan </h2><h2>".Roll::spin(['SSR ITEM' => 0.1,
'SSR ITEM 2' => 0.2,
'SSR ITEM 3' => 0.3,
'SSR ITEM 4' => 0.4,
Expand Down
2 changes: 1 addition & 1 deletion view/home/body.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="row">
<div class="col-md-5">
<div class="alert alert-primary">
<?= "<h2>kamu mendapatkan </h2><h2>". Roll::spin()."</h2>" ?>
<?= "<h2>kamu mendapatkan </h2><h2>".Roll::spin()."</h2>" ?>
</div>
</div>
</div>
Expand Down