php __sleep code example
Example 1: sleep php
<?php
sleep(4);
echo "Done\n";
?>
Example 2: php magic methods
__construct(),
__destruct(),
__call(),
__callStatic(),
__get(),
__set(),
__isset(),
__unset(),
__sleep(),
__wakeup(),
__serialize(),
__unserialize(),
__toString(),
__invoke(),
__set_state(),
__clone(),
__debugInfo()
Example 3: php invoke
<?php
class CallableClass
{
public function __invoke($x)
{
var_dump($x);
}
}
$obj = new CallableClass;
$obj(5);
var_dump(is_callable($obj));
?>
Example 4: sleep php
<?php
sleep(4);
echo "Done\n";
?>