Advertisement
ph4x35ccb

Ordena a b c erro linha 34 classe ordena.php

Apr 11th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2. class Ordena
  3. {
  4.     protected $a;
  5.     protected $b;
  6.     protected $c;
  7.     //contrutor//
  8.     /*public function __construct($a,$b,$c){
  9.         $this->a=$aa;
  10.         $this->b=$bb;
  11.         $this->c=$cc;
  12.     }*/
  13.     //metodos especiais//
  14.     public function getA(){
  15.         return $this->a;
  16.     }
  17.     public function setA($aa){
  18.         $this->a=$aa;
  19.     }
  20.  
  21.     public function getB(){
  22.         return $this->b;
  23.     }
  24.     public function setB($bb){
  25.         $this->b=$bb;
  26.     }
  27.  
  28.     public function getC(){
  29.         return $this->b;
  30.     }
  31.     public function setC($cc){
  32.         $this->c=$cc;
  33.     }
  34.     //fincao ordena a b c/
  35.     public function ordenador(){
  36.     if($this->a > $this->b & $this->b > $this->c){
  37.         print ("a,b,c");
  38.     }elseif($this->b > $this->c & $this->c > $this->b){
  39.         print("b,c,a");
  40.     }else($this->b > $this->c){
  41.         print("b,a,c");
  42.     }
  43. }
  44.  
  45.  
  46. // index
  47.  
  48. <?php
  49. require 'ordena.php';
  50. $ord = new Ordena();
  51. $ord->setA(3);
  52. $ord->setB(2);
  53. $ord->setC(1);
  54.  
  55. $ord->ordenador();
  56. //print_r($ord);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement