I’ve been using __FILE__ for years, but I never thought to look for its siblings.
echo ‘ line:’. __LINE__ .’ file:’. __FILE__ .’ directory:’. __DIR__ .’ function:’. __FUNCTION__ .’ class:’. __CLASS__ .’ method:’. __METHOD__ .’ namespace:’. __NAMESPACE__;
I feel as though I should have noticed these earlier; they’re clearly referenced in the docs for debug_backtrace(), after all.
Posted April 27, 2009 by Casey Bisson
Categories: Dispatches, Technology. Tags: class, constants, dir, file, function, line, magic, method, namespace, php, __CLASS__, __DIR__, __FILE__, __FUNCTION__, __LINE__, __METHOD__, __NAMESPACE__. Be the first one.
WP 2.6 allows sites to move the wp-content directory around, so plugin developers like me can’t depend on them being in a predictable location. We can look to the WP_CONTENT_DIR and WP_PLUGIN_DIR constants for answers, but a better solution is likely to use the X_url() functions. The most useful of those is likely to be [...]
Posted October 21, 2008 by Casey
Categories: Dispatches, Technology. Tags: constants, functions, path, paths, plugins_url, wordpress, wp-content, WP_CONTENT_DIR. Be the first one.