Created
December 25, 2016 11:50
-
-
Save gorkamu/bdcb95d367aa619bc33105210fea6477 to your computer and use it in GitHub Desktop.
Ejemplo de método mágico __debugInfo()
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 C { | |
private $prop; | |
public function __construct($val) { | |
$this->prop = $val; | |
} | |
public function __debugInfo() { | |
return [ | |
'propSquared' => $this->prop ** 2, | |
]; | |
} | |
} | |
var_dump(new C(42)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment