SetCallback

SetCallback — Registers a callback function

Synopsis

$plot->SetCallback($reason, $function, [$arg])
    

Description

SetCallback registers a callback function. That is, it arranges for the caller-provided function to be called at a specific point or point inside PHPlot's internal processing.

Parameters

$reason

A PHPlot-defined name for the callback. See Section 9.3, “Available Callbacks”.

$function

The function to be called. This can be either the name of a function as a string, or a two-element array with an object class instance and method name. See Section 9.1, “Callbacks Application Interface” for more information.

$arg

An optional opaque argument passed-through to the callback function when PHPlot triggers the callback. If not supplied, the callback function will get a NULL argument.

Return Value

Returns True if the callback has been registered. Returns False on error. The only error condition is if the given callback reason is not valid. Note that the function name is not validated until the callback is triggered.

Notes

If a callback is already registered for the given reason, the new callback replaces the old one.

Callbacks are an experimental feature added to PHPlot-5.0.4. Refer to Chapter 9, Callbacks for more information.