Created
December 25, 2016 11:46
-
-
Save gorkamu/8afcca0e6c9e0814522b95ad4eb17e54 to your computer and use it in GitHub Desktop.
Ejemplo del método mágico __invoke()
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 CallableClass | |
{ | |
public function __invoke($x) | |
{ | |
var_dump($x); | |
} | |
} | |
$obj = new CallableClass; | |
$obj(5); | |
var_dump(is_callable($obj)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment