Is it possible in PHP (as it is in C++)
to declare a class method
OUTSIDE the class definition?
Yes it is possible to add a method to a PHP class after it is defined. You want to use classkit, which is an "experimental" extension. It appears that this extension isn't enabled by default however, so it depends on if you can compile a custom PHP binary or load PHP DLLs if on windows (for instance Dreamhost does allow custom PHP binaries, and they're pretty easy to setup).
bar('Hello world!');
Example from the PHP manual:
add(12, 4);