SetCallback
Prev | PHPlot Function Reference | Next

## 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 points inside PHPlot's internal processing.

## Parameters

`$reason`

  A PHPlot-defined name for the callback. See Section 4.4.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 4.4.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.

Refer to Section 4.4, “Callbacks” for more information on callbacks.

## History

This function and the callbacks implementation were added in PHPlot-5.0.4 as an experimental feature. Callbacks were first documented in this manual as of PHPlot-5.0.5 and are no longer considered experimental.

Prev | Up | Next
SetBrowserCache | Home | SetDataBorderColors