403Webshell
Server IP : 109.234.162.214  /  Your IP : 216.73.216.222
Web Server : Apache
System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64
User : carpe ( 1178)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/carpe/public_html/starship/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/carpe/public_html/starship/tests/objet2.php
<?php

class Personne{
    public $nom;
    public $prenom;
    public $age;
    
    public function __construct($n,$p,$a) {
        $this->nom = $n;
        $this->prenom = $p;
        $this->age = $a;
    }
    
    public function sePresenter(){
        return "Je m'appelle {$this->nom} {$this->prenom}, j'ai {$this->age} ans.";
    }
    
    public function toArray() {
            return [
                'nom' => $this->nom,
                'prenom' => $this->prenom,
                'age' => $this->age,
            ];
        }
}

class Operateur extends Personne{
    public $metier;
    
    public function __construct($n,$p,$a,$m) {
        parent::__construct($n,$p,$a);
        $this->metier = $m;
    }
    
    public function presentation(){
        echo $this->sePresenter();
        return "Je suis {$this->metier}.";
    }
}

class Mentaliste extends Personne{
    public $mana;
    
    public function __construct($n,$p,$a,$m) {
        parent::__construct($n,$p,$a);
        $this->mana = $m;
    }
    
    public function presentation(){
        echo $this->sePresenter();
        return "J'ai {$this->mana} de mana.";
    }
    
    public function infiltration(){
        
    }
    
}

$o1 = new Operateur("Wils","Tony",40,'Pilote');
//echo $o1->presentation();

$personnes = [
    new Operateur("Alice", "Jsp",30,"Medecin"),
    new Operateur("Bob","Lewer", 35,"Agent dentretient"),
    new Mentaliste("Charlie","Chaplin", 28 ,50),
    new Mentaliste("Diana","Fraise", 32, 50)
];

foreach ($personnes as $personne) {
    if ($personne instanceof Operateur) {
        echo $personne->presentation() . " (C'est un opérateur)<br>";
    } elseif ($personne instanceof Mentaliste) {
        echo $personne->presentation() . " (C'est un mentaliste)<br>";
    } else {
        echo $personne->sePresenter() . " (Type inconnu)<br>";
    }
}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit