Usuario:ManuelRomero/Laravel/artisan

De WikiEducator
Saltar a: navegación, buscar
<?php
 
class prueba{
    public function __construct() {
        echo "hola desde contruct ";
    }
    public function prueba($a){
        echo "hola desde prueba $a";
    }
}
 
$p = new prueba(5);
 
?>
class prueba{
  <?php
class Complejo{
 
private $real;
private $imaginario;
 
    public function __construct( $a, $b) {
        $this->real = $a;
        $this->imaginario=$b;
    }
    public function  conjugado(Complejo $n){
        return new Complejo ($a, -$b);
 
    }
 
 
}
 
?>
}
<?php
class Complejo{
 
public $dia;
public $mes;
public $year;
 
    public function __construct( $d, $m,$y) {
        $this->dia = $d;
        $this->mes=$m;
        $this->year=$y;
    }
    public function getDia(){
        return ($this->dia);
    }
    public function getMes(){
        return ($this->mes);
    }
    public function getYear(){
        return ($this->year);
    }
 }
 
?>

<?php

class Fecha {

   public $dia;
   public $mes;
   public $year;

//sin tener en cuenta años bisiestos

   static function valida() {
       switch ($this->mes) {
           case 1:
           case 3:
           case 5:
           case 7:
           case 8:
           case 10:
           case 12:
               if ($this->dia > 31)
                   echo "Error  en la fecha en el dia";
               break;
           case 4:
           case 6:
           case 9:
               if ($this->dia > 30)
                   echo "Error  en la fecha en el dia";
               break;
           case 2:
               if ($this->dia > 28)
                   echo "Error  en la fecha en el dia";
               break;
           default:
               echo "Error en mes"
       }
   }
   public function __construct($d, $m, $y) {
       $this->dia = $d;
       $this->mes = $m;
       $this->year = $y;
   }
   public function getDia() {
       return ($this->dia);
   }
   public function getMes() {
       return ($this->mes);
   }
   public function getYear() {
       return ($this->year);
   }

}

$fecha = new fecha(33,2,1990); $fecha::valida();

?> </source>