Created
November 19, 2016 09:07
-
-
Save gorkamu/8152132f616b3d913963bc8a960d7c8b to your computer and use it in GitHub Desktop.
Ejemplo 2 de clase anónima
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->num = $num; | |
} | |
}); | |
// Resultado | |
// --------- | |
// object(class@anonymous)#1 (1) { | |
// ["Command line code0x104c5b612":"class@anonymous":private]=> | |
// int(10) | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment