Skip to content

Instantly share code, notes, and snippets.

@gorkamu
Created November 19, 2016 09:07
Show Gist options
  • Save gorkamu/8152132f616b3d913963bc8a960d7c8b to your computer and use it in GitHub Desktop.
Save gorkamu/8152132f616b3d913963bc8a960d7c8b to your computer and use it in GitHub Desktop.
Ejemplo 2 de clase anónima
<?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