# PHP Language Query

- Thread: https://externals.io/message/13130
- Original archive: https://news-web.php.net/php.internals/13130
- Started by Daniel O'Connor on 2004-10-04T08:42:26+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #13130 — Daniel O'Connor — 2004-10-04T08:42:26+00:00

URL: https://externals.io/message/13130#13130

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)



Suggestions, thoughts, or "RTFM"'s appreciated
-Daniel O'Connor
-- 
http://www.ahsonline.com.au/dod/FOAF.rdf
