io non vorrei fare il guastafeste ma per sapere se una variabile è una funzione basta fare così:
codice:
function isFunction(f) {
return typeof(f) == "function" || f.constructor == Function
};
dovrebbe funzionare su tutti ... e stando alla PHP_Serializer questo metodo non ha mai cannato.
[edit]
oooops ... correggo, sulla PHP_Serializer uso instanceof ... quindi la funzione dovrebbe essere così (mix delle due)
codice:
function isFunction(f) {
return typeof(f) == "function" ||
f.constructor == Function ||
f instanceof(Function)
};
[edit 2]
per avere compatibilità anche con IE4 ...
codice:
function isFunction(f) {
return typeof(f) == "function" ||
f.constructor == Function ||
eval("f instanceof(Function)")
};