Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created June 8, 2009 19:27
Show Gist options
  • Save rafaelss/126009 to your computer and use it in GitHub Desktop.
Save rafaelss/126009 to your computer and use it in GitHub Desktop.
<?php
class Callable {
public function __invoke(array $options) {
print_r($options);
}
}
class Model {
public $attribute;
public function __construct() {
$this->attribute = new Callable();
}
}
$callable = new Callable();
$callable(array('conditions' => '1 = 1'));
$model = new Model();
$model->attribute(array('order' => 'name ASC'));
?>
#############
## OUTPUT
Array
(
[conditions] => 1 = 1
)
Fatal error: Call to undefined method Model::attribute() in /home/rafael/projects/php53/callable.php on line 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment