On 3 May 2017 at 02:23, Martin "eto" Misuth <et.c...@ethome.sk> wrote:
>
> there is one thing I don't know what to do about, and need your advice. What
> about module name clash? I would prefer, for this alternative module, to be
> named filter as well

IMO that violates the principle of least astonishment - a function
that has the same name as an internal PHP function doing something
different.

However if you really want to do that, 'overloading' internal
functions can be achieved by (ab)using namespaces:

namespace Foo {
    function filter_var($input, $filter = FILTER_DEFAULT ,$options = []) {
        echo "I am a custom filter function";
        return $input;
    }
}

namespace Bar {
    use function Foo\filter_var as filter_var;
    $val = filter_var("someInput");
}

Output is "I am a custom filter function"

cheers
Dan

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to