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 Numero | |
| { | |
| private $valor; | |
| public function __construct($valor) { | |
| $this->valor = $valor; | |
| } | |
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 sum(...$nombres) { | |
| $saludo = 'Hola '; | |
| foreach ($nombres as $nombre) { | |
| $saludo .= $nombre; | |
| } | |
| return $saludo; | |
| } |
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 saluda($nombre = 'Gorka') { | |
| echo 'Hola '.$nombre.PHP_EOL; | |
| } | |
| saluda(); // Imprime 'Hola Gorka' | |
| saluda('Fino'); // Imprime 'Hola Fino' |
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 | |
| $nombre = 'Gorkamu'; | |
| function saluda(&$nombre) { | |
| $nombre = 'Fino'; | |
| return $nombre; | |
| } | |
| echo $nombre; // Imprime '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 | |
| $nombre = 'Gorkamu'; | |
| function saluda($nombre) { | |
| $nombre = 'Gorkamu eres un gandul!'; | |
| echo 'Hola '.$nombre.PHP_EOL; | |
| } | |
| echo $nombre; // Imprime '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 ChuckyDeCieza | |
| { | |
| function __construct() { | |
| print "Diez pastillones y no me diste ni mielda".PHP_EOL; | |
| } | |
| function __destruct() { | |
| print "Quieres sentirla en el pesho?".PHP_EOL; | |
| } |
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 | |
| { | |
| private $salario; | |
| private $medidas; | |
| public function __construc($salario, $medidas) { | |
| $this->salario = $salario; | |
| $this->medidas = $medidas; |
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 QUE_SOY = 'Soy la polla', | |
| public function queSoy() { | |
| return self::QUE_SOY; | |
| } | |
| } |
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 Television | |
| { | |
| public $tipo = 'Television plana'; | |
| protected $pulgadas = '47 pulgadas'; | |
| private $marca = 'Samsung'; | |
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 PaqueteDeGoldenVirginia extends PaqueteDeTabaco | |
| { | |
| private $marca = 'golden virginia'; | |
| private $tipo = 'rubio'; | |
| // Redefinición del método padre | |
| function sacarCigarrillo() | |
| { |