Advertisement
ujiajah1

saya.php

Oct 24th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.19 KB | None | 0 0
  1. <?php
  2. class handphone{
  3.     public $kamera;
  4.     public $tahun;
  5.     public $layar_sentuh = true;
  6.  
  7.     public function __construct($kamera,$tahun){
  8.         $this->kamera = $kamera;
  9.         $this->tahun = $tahun;
  10.     }
  11.     public function jepret_bro(){
  12.         return "$this->kamera"."\n".$this->tahun."\n"."Jepret...!!";
  13.     }
  14. }
  15. $jadul = new handphone("Kamera : 2 Megapixels", "Tahun  :2013");
  16. $canggih = new handphone("Kamera : 8 Megapixels", "Tahun  : 2016");
  17. $jadul->layar_sentuh = true;
  18. $mantap_bos = $jadul->jepret_bro(); //rubah jadi $jadul
  19. echo $mantap_bos."\n\n";
  20.  
  21. if($mantap_bos == $canggih->jepret_bro()){
  22.     echo "Mantap Boss Hp nya";
  23. }elseif($mantap_bos !== $canggih->jepret_bro()){
  24.     echo "Muka Masa Kini, HP MASA GITU !!!";
  25. }else{
  26.     echo "Modol Beton";
  27. }
  28. ?>
  29.  
  30. #===============================================================================================================================
  31.  
  32.  
  33. <?php
  34. class handphone{
  35.     public $kamera;
  36.     public $tahun;
  37.     public $layar_sentuh = true;
  38.    
  39.     public function __construct($kamera,$tahun){
  40.         $this->kamera = $kamera;
  41.         $this->tahun = $tahun;
  42.     }
  43.    
  44.     public function ambil_photo(){
  45.         return $this->kamera."\n".$this->tahun."\n"."Jepret...!!!";
  46.     }
  47. }
  48. $canggih = new handphone("Kamera : 8 megapixels", "Tahun  : 2013");
  49. $jadul = new handphone("kamera : 2 Megapixels", "Tahun  : 2010");
  50. $jadul->layar_sentuh = false;
  51. echo $canggih->ambil_photo();
  52. ?>
  53. #===============================================================================================================================
  54. <?php
  55. class shining{
  56.     public $stanley;
  57.     public $kubrick;
  58.     public $sutradara;
  59. public function __construct($stanley, $kubrick, $sutradara){
  60.     $this->film = $stanley;
  61.     $this->horror = $kubrick;
  62.     $this->director = $sutradara;
  63.  
  64. }
  65.  
  66. public function  psychological_horror(){
  67.     return "$this->film adalah film yang bergenre $this->horror besutan $this->director"."\n".
  68.     "film $this->horror yang paling keren menurut gua";
  69. }
  70. }
  71. $nonton = new shining("the shining"," psychological horror","stanley kubrick");
  72. echo $nonton->psychological_horror();
  73. echo "\n";
  74. $shining = "All Work No Play Makes Jack a dull boy";
  75. for($a=1; $a<1000; $a++){
  76.     echo $shining."\n";
  77. }
  78.  
  79. ?>
  80. #===============================================================================================================================
  81.  
  82.  
  83. <?php
  84. class shining{
  85.     public $shining = "All Work No Play Makes Jack a dull boy";
  86.     public $stanley;
  87.     public $kubrick;
  88. }
  89. $andy = new shining();
  90. $toby = new shining();
  91.  
  92. for($maman=1; $maman < 70; $maman++){
  93.     echo "\n$andy->shining";
  94.  
  95. }
  96. ?>
  97. #===============================================================================================================================
  98.  
  99. <?php
  100. class siapakah_anda{
  101.     public $alamat = "CimahiSelatan-Cimahi";
  102.     public $nama;
  103.     public $umur;
  104. }
  105. $saya = new siapakah_anda();
  106. $anda = new siapakah_anda();
  107.  
  108. echo "Dimanakah Saya tinggal, saya tinggal di $saya->alamat";
  109. ?>
  110. #===============================================================================================================================
  111.  
  112.  
  113. <?php
  114. class datadiri{
  115.     public $nama;
  116.     public $usia;
  117.    
  118.     public function __construct($nama, $usia){
  119.         $this->nama = $nama;
  120.         $this->usia = $usia;
  121.     }
  122.     public function kenalan(){
  123.         return "Hi, Perkenalkan nama saya $this->nama usia saya $this->usia";
  124.     }
  125. }
  126. $datadiri = new datadiri("Puji torvald", 29);
  127. echo $datadiri->kenalan();
  128. ?>
  129. #===============================================================================================================================
  130.  
  131. <?php
  132. class datasaya {
  133.     public $saya ;
  134.     public $project;
  135.    
  136.     public function __construct($saya, $project){
  137.         $this->saya = $saya;
  138.         $this->project = $project;
  139.     }
  140.    
  141.     public function kenalkan(){
  142.         return "Hai, perkenalkan saya ". "= ". $this->saya."\n".
  143.         "Pekerjaan saya "."= ". $this->project;
  144.     }
  145. }
  146. $saya = new datasaya("puji ermanto","Front-end web developer");
  147. echo $saya->kenalkan();
  148. ?>
  149. #===============================================================================================================================
  150. <!DOCTYPE html>
  151. <html>
  152. <head>
  153. <title>Saya</title>
  154. <script  type="text/javascript" src="jquery-3.1.1.min.js"></script>
  155. </head>
  156. <body>
  157. <h1>
  158. <?php
  159. class datadiri{
  160. public $saya;
  161. public $work;
  162. public function __construct($saya,$work){
  163. $this->saya = $saya;
  164. $this->work = $work;
  165. }
  166. public function perkenalkan(){
  167.     for($a=1; $a < 72; $a++){
  168.         echo "=";
  169.     }
  170.     echo "<br />";
  171.         echo "<center>|Hi, Dunia"."<br />"."|Perkenankanlah saya memperkenalkan diri saya|"."<br />"."</center>";
  172.     for($a=1; $a < 72; $a++){
  173.         echo "=";
  174.     }
  175.     echo "<br />";
  176.    
  177. return "Perkenalkan "."= "."saya $this->saya"."<br />"
  178. ."Pekerjaan "."= "."alhamdulillah saya adalah seorang $this->work.";
  179. }
  180. }
  181. $saya = new datadiri("Puji Ermanto","Front-End Web Developer");
  182. echo $saya->perkenalkan();
  183. ?></h1>
  184. <button id="myButton">Hai!!!</button>
  185. <script type="text/javascript">
  186. $(document).ready(function(){
  187. $("#myButton").click(function(e){
  188. alert('<?php
  189. class kenalan{
  190.     public $saya;
  191.     public $work;
  192.     public function __construct($saya, $work){
  193.         $this->saya = $saya;
  194.         $this->work = $work;
  195.     }
  196.     public function perkenalkan(){
  197.         return "Hai, perkenalkan saya = $this->saya pekerjaan saya = $this->work";
  198.     }
  199. }
  200. $saya = new kenalan("Puji Ermanto"," Front-End Web Developer");
  201. echo $saya->perkenalkan();
  202. ?>');
  203. });
  204. });
  205. </script>
  206. </body>
  207. </html>
  208. #===============================================================================================================================
  209.  
  210.  
  211. <?php
  212. class hipster{
  213. public $lokasi = "Bandung";
  214. public $nama = "Puji Ermanto";
  215. public $work = "Hipster@Network";
  216. }
  217. $nama = new hipster();
  218. $work = new hipster();
  219. $lokasi = new hipster();
  220. for($okt = 1; $okt < 20; $okt++){
  221. echo "||";
  222. }
  223. echo "\n";
  224. echo "|| Nama = ".$nama->nama." ||"."\n";
  225. echo "|| Work = ".$work->work." ||"."\n";
  226. echo "|| Location = ".$lokasi->lokasi." ||"."\n";
  227. for($okt = 1; $okt < 20; $okt++){
  228. echo "||";
  229. }
  230. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement