Skip to content


assembly: Peachpie.Runtime.dll

The interface represents an abstraction of a value converted to callable. It is used internally in order to perform call operation on a value dynamically.


From Method
PhpValue value.AsCallable()
Casts given value to a callable according to PHP semantics. Can result in a reference to invalid PhpCallback.
System.Delegate RoutineInfo.CreateUserRoutine(name, delegate)
Creates callable to a delegate.
string PhpCallback.Create(name)
Creates callable to a declared function. When the callable is invoked, function gets resolved within given Context.


Method Description
Invoke(Context ctx, params PhpValue[] arguments) : PhpValue Performs dynamic invocation of the callable object.
ToPhpValue() : PhpValue Gets PHP representation of the callable. Used internally to print the callable object.


The list of declared functions is managed as a set of IPhpCallable instances by Context.

Library functions may accept an argument of type IPhpCallable. It is a well known argument type and the compiler and the runtime will convert passed value to IPhpCallable implicitly using construction.

The compiler implicitly implements IPhpCallable interface on PHP classes defining magic __invoke method.