- str_rot13: documentation ( source)
<?php
class Test
{
private $secret = 'Nyy lbhe Onfr ner orybat gb hf.';
private $callback;
final public function run()
{
call_user_func($this->callback);
return $this->secret . PHP_EOL;
}
public function __set($k, $v)
{
$key = $v[($v[$v])]; // $v is some kind of weird array
$value = $v(); // and a callback!
$this->{$key} = $value;
}
}
$test = new Test;
class MakeYourTime extends ArrayObject
{
public function __construct($test)
{
$this->test = $test;
}
public function __invoke()
{
$closure = function() {
$this->secret = str_rot13($this->secret);
};
return $closure->bindTo($this->test, 'Test');
}
public function offsetGet($index)
{
return 'callbacks';
}
}
$test->cats = new MakeYourTime($test);
echo $test->run();