views:

178

answers:

2

Hello All,

PHP allows you to replace or even re-name PHP's built-in functions using functions such as override_function and rename_function.

Can we override the PHP's language constructs like the ones below?

echo
eval
...etc
+2  A: 

I don't think it's possible : it's a language construct, which means something that's more than "integrated" to the language : it's really a "part" of the language.

Pascal MARTIN
+2  A: 

No, this isn't possible within PHP.

The only way I can think of would be to create a custom handler for PHP files (in apache or whichever web server you're using).

The custom handler could then search and replace core language constructs with functions of your own, before being passed to the real PHP handler.

Dave Challis