With "standard" PHP, no, you cannot do such a thing.
Still, looking at PECL and the manual, a possibility would be to use the classkit extension -- but it's marked as "not maintained", and has not been updated since 2004... So I would definitly not use it.
Quoting the PECL's page of that extension :
NOTICE: This package has been
discontinued. Please refer to the
runkit package which is fully BC with
classkit and contains additional
functionality.
So, let's take a look at the runkit extension, which might do the trick -- especially, the runkit_import
function could interest you (quoting) :
Similar to include()
however any
code residing outside of a function or
class is simply ignored. Additionally,
depending on the value of flags ,
any functions or classes which already exist in the currently running
environment will be automatically
overwritten by their new
definitions.
Still, note that, officially (looking at it's PECL page), the runkit extension has not been updated since 2006... Which is not a good sign either... Especially when it comes to PHP 5.3 support...