I have an existential doubt, I can not do that within a parameter that becomes a callback function enter and manipulate the same function, I have no idea what this would be like, but in this example it shows it.
<?php
class where{
public function show_sql( $params ){
if( is_numeric($params) ){
echo "Number $params <br />";
}elseif( is_callable($params) ) { // here validate if function
// get_defined_vars() <--- I get the variables but I can not manipulate same function
}
return $this;
}
}
$DB = new where;
$DB->show_sql(12)
->show_sql(13)
->show_sql(function ($object){
$object->show_sql(14);
});
?>
The result would be
Number 12
Number 13
But the number 14 is not shown and I call it in the same function. I want to have the same result as Laravel does in this example: https://laravel.com/docs/master/queries#where-clauses go to Parameter Grouping
Someone could help me ?
->show_sql(function ($object){ $object->show_sql(14); });I think that here I am making the parameter a callback so that I can use the same function again but I do not know how to call the same function againis_callable()works for closures as well. It will return true as long as the variable can be called as a function.