PHP: Passing functions to a class
<p>I made a class. I give it some objects (mostly retreived database rows) as input, and tell it which fields it has to show, and which buttons I want. Then it renders a very nice html table! It's pretty awesome, I think.</p>

<pre><code>$ot = new ObjectTable();
$ot-&gt;objects = $some_objects;
$ot-&gt;fields = array('id','name','description','image');
$ot-&gt;buttons = array('edit','delete');
$ot-&gt;render();
</code></pre>

<p>However, I also want to be able to manipulate the data it shows. For example, i want to be able to truncate the 'description' field. Or to display an image thumbnail (instead of 'picture.jpg' as text). I don't know how to pass these functions to the class. Perhaps something like:</p>

<pre><code>$ot-&gt;functions = array(null,null,'truncate','thumbnail');
</code></pre>

<p>But then I don't know how to convert these strings to run some actual code, or how to pass parameters. </p>

<p>There must be a nice way to do what I want. How?</p>
