How can I create a function out my php select? <p>How can I create a function out of my php select? Here is the code:</p> <pre><code>&lt;? $sql = "SELECT value FROM configuration WHERE name = 'website_name'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); ?&gt; &lt;?=$row['value'];?&gt; </code></pre> <p>Basically I want to turn it into a function and call it as a variable so something like this. Here is the code:</p> <pre><code>&lt;? function ItsaFunction() { //code goes here } ?&gt; </code></pre> <p>I want to output the code as a variable. Here is the code:</p> <pre><code>&lt;?=$ItsaFunction?&gt; </code></pre> <p>How can I convert my select to a function and call it as a variable?</p>