if you're reading this you know javascript can have fucntions bound to events like onchange or onsubmit etc.
I know you can fork off a new process in PHP, but have never done it. but now I have a very specific question on another concept:
Is there any way to have a resident function running parallel to a ascript, not actually referenced in the coding, which can read the global variables and "interject itself" when certain conditions apply?
for example, suppose I have a script which is building an array. Sure, each time I'm building an array I could add to the loop:
if(is_too_big($array)) {
//do something
}
but I would like to define a "listener" for a defined event like "ongettoobig" so that, without actual coding, the attached function would fire off as soon as we did:
$biglist[]='one more item here';
and count($biglist) exceeded a defined limit.
For those of you who first ask "why do you want to do this?" vs. simply "yes it's possible" or "no, it's not", I would like to allow "add-ons" to be put into an application where the coding of logic through a script to ask every single logical question (if addon x is installed, then here..) would get cumbersome.
I hope this is explained well, thank you and let me know.
Samuel