Php, how to pass a class reference to a method? -



Php, how to pass a class reference to a method? -

this question has reply here:

php: dynamic or programmatic grab blocks 1 reply asserttriggerthisexception ('exception'); asserttriggerthisexception ('anotherexceptionclass'); function asserttriggerthisexception ($exceptionclassname) { seek { triggers exception } grab ($$exceptionclassname $e) // error { } }

so want pass reference class itself, causes syntax error. want "dinamically" expect exception, there way?

i think can seek

$someclass = 'someexception'; seek { $some->thing(); } grab (exception $e) { switch (get_class($e)) { case $someclass: echo 'dynamic exception.'; break; default: echo 'normal exception.'; } }

php

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -