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 | |
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 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 | |
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 | |
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 | |
class MiIterador implements Iterator | |
{ | |
private $var = array(); | |
public function __construct($array) | |
{ | |
if (is_array($array)) { | |
$this->var = $array; |
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 $nombre = 'Gorkamu'; | |
public $web = 'http://www.gorkamu.com'; | |
protected $edad = '27'; | |
private $telefono = '66. ... ...'; |
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 $nombre = 'Gorkamu'; | |
public $web = 'http://www.gorkamu.com'; | |
} | |
$gorkamu = new Gorkamu(); | |
$serialize = serialize($gorkamu); |
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 SubObject | |
{ | |
static $instances = 0; | |
public $instance; | |
public function __construct() { | |
$this->instance = ++self::$instances; | |
} |
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 | |
function bool2str($bool) | |
{ | |
if ($bool === false) { | |
return 'FALSO'; | |
} else { | |
return 'VERDADERO'; | |
} | |
} |