This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| abstract class Animal | |
| { | |
| abstract public function moverse(); | |
| } | |
| class Gorrino extends Animal | |
| { | |
| public function moverse() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| interface iTemplate | |
| { | |
| public function setVariable($name, $var); | |
| public function getHtml($template); | |
| } | |
| class Template implements iTemplate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Util | |
| { | |
| private $logger; | |
| public function setLogger(Logger $logger) { | |
| $this->logger = $logger; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Util {} | |
| interface Serializable {} | |
| var_dump(new class(10) extends Util implements Serializable { | |
| private $num; | |
| public function __construct($num) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Externa | |
| { | |
| private $prop = 1; | |
| protected $prop2 = 2; | |
| protected function func1() { | |
| return 3; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| spl_autoload_register(function ($nombre_clase) { | |
| include $nombre_clase . '.php'; | |
| }); | |
| $gorkamu = new Gorkamu(); | |
| $ukelele = new Ukelele(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Aplicacion\Libreria\Components as Componentes { | |
| const CONECTAR_OK = 1; | |
| class Conexión { /* ... */ } | |
| function conectar() { /* ... */ } | |
| } | |
| namespace Aplicacion\Recursos\Utils { | |
| const CONECTAR_OK = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| trait movimientos { | |
| function saltar() { /* ... */ } | |
| function correr() { /* ... */ } | |
| function nadar() { /* ... */ } | |
| } | |
| class Gato extends Animal { | |
| use movimientos; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Animal { | |
| public function correr() { | |
| echo 'Estoy corriendo '; | |
| } | |
| } | |
| trait movimientos { | |
| public function correr() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| trait HolaMundo { | |
| public function decirHola() { | |
| echo 'Hola Mundo!'; | |
| } | |
| } | |
| // Cambiamos visibilidad de decirHola | |
| class MiClase1 { |