Hi,
Apologies if this is the inappropriate place to ask; however:
I'm trying to minimise the amount of PHP I have to code.
For instance:
function callbackIterator($array,&$callbackFunction) {
//If $array is actually an array, iterate through all of the values and
//call $callbackFunction($array[$i])
//else, just return.
}
class Foo {
function bar($mixed) {
callbackIterator($mixed,$something));
// Rest of functionality here
}
function bar2($mixed) {
callbackIterator($mixed,$something));
// Rest of functionality here
}
}
Rather than implement for every function stuff to check if its an
array, format it correctly and whatever, is there any kind of internal
functionality that is exposed to enable $something to pass "this
current instance of this class's function pointer"..
.
Being able to do so would allow me to save loads of time developing as
I can write it once and use it anywhere...
It was suggested an alternative would be to have a wrapper outside of
the function:
call($mixed,$function), which is workable but not pretty for your
typical noober who doesn't like messing with objects...
ie
callbackIterator($args, $Foo->Function)