Description

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
may be automatically overwritten by their new definitions.

Return Values

Examples

/* import classes, but not imports their static properties (RUNKIT_IMPORT_CLASS_STATIC_PROPS is available since 1.0.1) */runkit_import('myfile.inc', RUNKIT_IMPORT_CLASSES & ~RUNKIT_IMPORT_CLASS_STATIC_PROPS);

/* import only static properties of classes (RUNKIT_IMPORT_CLASS_STATIC_PROPS is available since 1.0.1) */runkit_import('myfile.inc', RUNKIT_IMPORT_CLASS_STATIC_PROPS);?>

User Contributed Notes 6 notes

It appears that this function still doesn't remove the previous class. I'm not sure what it does to it, but looking at memory usage, it only goes up instead of staying the same or going down (This was when I reloaded a class that was exactly the same).

I was experiencing problems using this function on a script. I discovered through trial and error that you CANNOT reload a function (or method of a class) if it has been called (e.g, its present in the debug_backtrace). Also you cannot redeclare a function that is used by set_error_handler.

The reasons are logical, but it took me a good 2 days of debugging to find it, hope this saves someone a headache.