<p>I want to use the <a href="http://simplehtmldom.sourceforge.net/manual_api.htm" rel="noreferrer">php simple HTML DOM parser</a> to grab the image, title, date, and description from each article on a page full of articles. When looking at the API I notice it has a set_callback which Sets a callback function. However im not sure what this does or how I would use it? In one of the examples its used to call a function which strips out some stuff, im wondering if you have to use this to call all functions?</p>

<p>I guess im wondering why I use this, and what does it do as I have never come across a callback function before!</p>

Here's a basic callback function example:
```
```
<?php

function thisFuncTakesACallback($callbackFunc)
{
    echo "I'm going to call $callbackFunc!<br />";
    $callbackFunc();
}

function thisFuncGetsCalled()
{
    echo "I'm a callback function!<br />";
}

thisFuncTakesACallback( 'thisFuncGetsCalled' );
?>
```
```
You can call a function that has its name stored in a variable like this:
$variable()
.
So, in the above example, we pass the name of the
thisFuncGetsCalled
function to
thisFuncTakesACallback()
which then calls the function passed in.