Last active
November 7, 2022 10:18
-
-
Save Fray117/c87b9e06dbaa57198186cd15e06c09a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller Luas Lingkaran Menggunakan CI | |
*/ | |
namespace App\Controllers; | |
class LuasLingkaran extends BaseController | |
{ | |
public function index() | |
{ | |
$diameter = 2; | |
$luas_lingkaran = ($diameter / 2) * M_PI; | |
return 'Luas lingkaran dengan diameter ' . $diameter . ' adalah: ' . $luas_lingkaran; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller & Model Luas Lingkaran Menggunakan CI | |
*/ | |
namespace App\Controllers; | |
class LuasLingkaranModel extends BaseController | |
{ | |
public function index() | |
{ | |
$model = new \App\Models\ModelLingkaran(); | |
$luas_lingkaran = ($model->diameter / 2) * M_PI; | |
return 'Luas Lingkaran dengan diameter ' . $model->diameter . ' adalah: ' . $luas_lingkaran; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller, Model, & Controller Luas Lingkaran Menggunakan CI | |
*/ | |
namespace App\Controllers; | |
class LuasLingkaranMVC extends BaseController | |
{ | |
public function index() | |
{ | |
$model = new \App\Models\ModelLingkaran(); | |
$luas_lingkaran = ($model->diameter / 2) * M_PI; | |
$data['diameter'] = $model->diameter; | |
$data['luas_lingkaran'] = $luas_lingkaran; | |
return view('luas_lingkaran', $data); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller & View Luas Lingkaran Menggunakan CI | |
*/ | |
namespace App\Controllers; | |
class LuasLingkaranView extends BaseController | |
{ | |
public function index() | |
{ | |
$diameter = 2; | |
$luas_lingkaran = ($diameter / 2) * M_PI; | |
$data['diameter'] = $diameter; | |
$data['luas_lingkaran'] = $luas_lingkaran; | |
return view('view_luas_lingkaran', $data); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Luas Lingkaran</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
</head> | |
<body> | |
<div class="heroe"> | |
<h1>Luas Lingkaran dengan diameter <?= $diameter ?> adalah <?= $luas_lingkaran ?></h1> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment