Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class handphone{
- public $kamera;
- public $tahun;
- public $layar_sentuh = true;
- public function __construct($kamera,$tahun){
- $this->kamera = $kamera;
- $this->tahun = $tahun;
- }
- public function jepret_bro(){
- return "$this->kamera"."\n".$this->tahun."\n"."Jepret...!!";
- }
- }
- $jadul = new handphone("Kamera : 2 Megapixels", "Tahun :2013");
- $canggih = new handphone("Kamera : 8 Megapixels", "Tahun : 2016");
- $jadul->layar_sentuh = true;
- $mantap_bos = $jadul->jepret_bro(); //rubah jadi $jadul
- echo $mantap_bos."\n\n";
- if($mantap_bos == $canggih->jepret_bro()){
- echo "Mantap Boss Hp nya";
- }elseif($mantap_bos !== $canggih->jepret_bro()){
- echo "Muka Masa Kini, HP MASA GITU !!!";
- }else{
- echo "Modol Beton";
- }
- ?>
- #===============================================================================================================================
- <?php
- class handphone{
- public $kamera;
- public $tahun;
- public $layar_sentuh = true;
- public function __construct($kamera,$tahun){
- $this->kamera = $kamera;
- $this->tahun = $tahun;
- }
- public function ambil_photo(){
- return $this->kamera."\n".$this->tahun."\n"."Jepret...!!!";
- }
- }
- $canggih = new handphone("Kamera : 8 megapixels", "Tahun : 2013");
- $jadul = new handphone("kamera : 2 Megapixels", "Tahun : 2010");
- $jadul->layar_sentuh = false;
- echo $canggih->ambil_photo();
- ?>
- #===============================================================================================================================
- <?php
- class shining{
- public $stanley;
- public $kubrick;
- public $sutradara;
- public function __construct($stanley, $kubrick, $sutradara){
- $this->film = $stanley;
- $this->horror = $kubrick;
- $this->director = $sutradara;
- }
- public function psychological_horror(){
- return "$this->film adalah film yang bergenre $this->horror besutan $this->director"."\n".
- "film $this->horror yang paling keren menurut gua";
- }
- }
- $nonton = new shining("the shining"," psychological horror","stanley kubrick");
- echo $nonton->psychological_horror();
- echo "\n";
- $shining = "All Work No Play Makes Jack a dull boy";
- for($a=1; $a<1000; $a++){
- echo $shining."\n";
- }
- ?>
- #===============================================================================================================================
- <?php
- class shining{
- public $shining = "All Work No Play Makes Jack a dull boy";
- public $stanley;
- public $kubrick;
- }
- $andy = new shining();
- $toby = new shining();
- for($maman=1; $maman < 70; $maman++){
- echo "\n$andy->shining";
- }
- ?>
- #===============================================================================================================================
- <?php
- class siapakah_anda{
- public $alamat = "CimahiSelatan-Cimahi";
- public $nama;
- public $umur;
- }
- $saya = new siapakah_anda();
- $anda = new siapakah_anda();
- echo "Dimanakah Saya tinggal, saya tinggal di $saya->alamat";
- ?>
- #===============================================================================================================================
- <?php
- class datadiri{
- public $nama;
- public $usia;
- public function __construct($nama, $usia){
- $this->nama = $nama;
- $this->usia = $usia;
- }
- public function kenalan(){
- return "Hi, Perkenalkan nama saya $this->nama usia saya $this->usia";
- }
- }
- $datadiri = new datadiri("Puji torvald", 29);
- echo $datadiri->kenalan();
- ?>
- #===============================================================================================================================
- <?php
- class datasaya {
- public $saya ;
- public $project;
- public function __construct($saya, $project){
- $this->saya = $saya;
- $this->project = $project;
- }
- public function kenalkan(){
- return "Hai, perkenalkan saya ". "= ". $this->saya."\n".
- "Pekerjaan saya "."= ". $this->project;
- }
- }
- $saya = new datasaya("puji ermanto","Front-end web developer");
- echo $saya->kenalkan();
- ?>
- #===============================================================================================================================
- <!DOCTYPE html>
- <html>
- <head>
- <title>Saya</title>
- <script type="text/javascript" src="jquery-3.1.1.min.js"></script>
- </head>
- <body>
- <h1>
- <?php
- class datadiri{
- public $saya;
- public $work;
- public function __construct($saya,$work){
- $this->saya = $saya;
- $this->work = $work;
- }
- public function perkenalkan(){
- for($a=1; $a < 72; $a++){
- echo "=";
- }
- echo "<br />";
- echo "<center>|Hi, Dunia"."<br />"."|Perkenankanlah saya memperkenalkan diri saya|"."<br />"."</center>";
- for($a=1; $a < 72; $a++){
- echo "=";
- }
- echo "<br />";
- return "Perkenalkan "."= "."saya $this->saya"."<br />"
- ."Pekerjaan "."= "."alhamdulillah saya adalah seorang $this->work.";
- }
- }
- $saya = new datadiri("Puji Ermanto","Front-End Web Developer");
- echo $saya->perkenalkan();
- ?></h1>
- <button id="myButton">Hai!!!</button>
- <script type="text/javascript">
- $(document).ready(function(){
- $("#myButton").click(function(e){
- alert('<?php
- class kenalan{
- public $saya;
- public $work;
- public function __construct($saya, $work){
- $this->saya = $saya;
- $this->work = $work;
- }
- public function perkenalkan(){
- return "Hai, perkenalkan saya = $this->saya pekerjaan saya = $this->work";
- }
- }
- $saya = new kenalan("Puji Ermanto"," Front-End Web Developer");
- echo $saya->perkenalkan();
- ?>');
- });
- });
- </script>
- </body>
- </html>
- #===============================================================================================================================
- <?php
- class hipster{
- public $lokasi = "Bandung";
- public $nama = "Puji Ermanto";
- public $work = "Hipster@Network";
- }
- $nama = new hipster();
- $work = new hipster();
- $lokasi = new hipster();
- for($okt = 1; $okt < 20; $okt++){
- echo "||";
- }
- echo "\n";
- echo "|| Nama = ".$nama->nama." ||"."\n";
- echo "|| Work = ".$work->work." ||"."\n";
- echo "|| Location = ".$lokasi->lokasi." ||"."\n";
- for($okt = 1; $okt < 20; $okt++){
- echo "||";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement