I have a script where it accepts a varying number of arguments.
I want to use func_get_args to perform operations on said arguments. If I have one function like this:
function Something() {
foreach(func_get_args($this) as $functions) {
// Do something
}
// Return..
}
I want to be able to call this function in, for example, another function to add/save entries. The add/save function would have arguments ‘title’, ‘description’ etc..
I basically want to know if there is a way to detect the context of a function call. Can I pass something to func_get_args that will let it know that its called in a certain function? So if I do:
function Save($title, $desc) {
$vars = $this->Something();
}
I want $vars to contain $title and $desc after modifying them.
Figured it out.. Not pretty, but it does what I want it to.
I had another way of doing this but the array had to be accessed using
$Vars[0], $Vars[1], etc, and I wanted to make it so I could use$Vars['something'], $Vars['something_else'].