Callback

from the Artful MySQL Tips List


This function uses a callback function.
function doIt($callback) {
  $data = acquireData();
  $callback($data);
}
This is a sample callback function for doIt().
function myCallback($data) {
  echo 'Data is: ', $data, "\n";
}
Call doIt() and pass our sample callback function's name.
doIt('myCallback'); 

Last updated 22 May 2009


Return to the Artful MySQL Tips page