php - catch constants as type string -


i have function takes constant string , know if possible obtain value of constant referent.

myfunction( "fetch_assoc" )
argument related pdo::fetch_assoc

is possible?
i'm putting class work database, thanks

yes, can use constant function.

note has full qualifier though. constant("pdo::fetch_assoc"), not constant("fetch_assoc") (unless want constant named fetch_assoc in global namespace, not in pdo class).


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -