0

Possible Duplicate:
Redefine Built in PHP Functions

I need to override one of the standard functions of php. in javascript, I would have done it this way:

    <script type="text/javascript">
        window.alert = function(str) {
            document.write(str);
        }
        alert("hello");
    </script>

whether it is possible to do this in php?

Community
  • 1
  • 1
kopaty4
  • 2,236
  • 4
  • 26
  • 39
  • 1
    possible duplicate of [Redefine Built in PHP Functions](http://stackoverflow.com/q/2326835/), [How to redefine a function in php?](http://stackoverflow.com/q/6925736/), [Redefining PHP function?](http://stackoverflow.com/q/2640958/), [Is it possible to overwrite a function in PHP](http://stackoverflow.com/q/3620659/) – outis Feb 10 '12 at 17:06
  • 2
    What particular PHP function are you trying to "override"? What are you trying to achieve? – Colin Brock Feb 10 '12 at 17:07
  • 1
    ... [Is it possible to replace (monkeypatch) PHP functions?](http://stackoverflow.com/q/530649/), [Is it possible to replace a function in php (such as mail) and make it do something else?](http://stackoverflow.com/q/1837184/), [Php redefine Class Methods OR Class](http://stackoverflow.com/q/137006/) – outis Feb 10 '12 at 17:21

2 Answers2

1

With the Advanced PHP Debugger PECL extension it is. See the override_function() docs.

WWW
  • 9,734
  • 1
  • 29
  • 33
0

No, there is a PHP module that can do that, but generally no.

override_function of the APD module

remy
  • 1,511
  • 10
  • 15