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 Gorkamu | |
{ | |
public function __call($method_name, $arguments) | |
{ | |
if(count($arguments) == 0) { | |
$this->saluda1(); | |
} elseif(count($arguments) == 1) { | |
$this->saluda2($arguments[0]); |
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 PutoAmo | |
{ | |
public function saluda() { | |
echo "Hola"; | |
} | |
final public function insulta() { | |
echo "Capullo"; |
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 PutoAmo | |
{ | |
protected function saluda() { | |
echo "Hola"; | |
} | |
} | |
class Gorkamu extends PutoAmo |
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 Gorkamu extends PutoAmo | |
{ | |
public static $blog = 'http://gorkamu.com'; | |
public static function cualEsMiBlog() { | |
echo self::$blog . "\n"; | |
} | |
} |
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 Gorkamu { | |
const BLOG = 'http://gorkamu.com'; | |
} | |
echo Gorkamu::BLOG; // http://gorkamu.com |
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 { |
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 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 | |
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 | |
spl_autoload_register(function ($nombre_clase) { | |
include $nombre_clase . '.php'; | |
}); | |
$gorkamu = new Gorkamu(); | |
$ukelele = new Ukelele(); |