lunes, 6 de junio de 2016

PHP OO - Clases 01

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP OO_01</title>
</head>

<body>

<?php
    class Coche{
       
        var $ruedas;
        var $color;
        var $motor;
       
        function Coche(){
            $this->ruedas = 4;
            $this->color = "";
            $this->motor = 1600;
        }
       
        function arrancar(){
            echo "Estoy arrancando<br>";
        }
       
        function girar(){
            echo "Estoy girando<br>";
        }
       
        function frenar(){
            echo "Estoy frenando<br>";
        }
       
    }
   
    $renault = new Coche(); //Estado inicial al objeto o instancia
    $mazda = new Coche ();
    $seat = new Coche();
   
    $mazda->girar(); //El objeto lleva parentesis
    echo $mazda->ruedas; //Las clases no llevan parentesis
?>


</body>
</html>

Cambiar imagen de fondo con JQuery

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <title>Cambiar ...