Is there a way to only pass a certain variable and it's value with the include function?
<p>I want to include a page that contains a variable with a value that I need to insert in a database, but when I include the page, functions out of the scope of the second page try to run, which leads to an undefined error. </p>

<p>Basically I want this:</p>

<pre><code>mainpage.php

    &lt;?php
    $variable = 'value';
    function();
    ?&gt;
</code></pre>

<p>secondpage.php</p>

<pre><code>    &lt;?php
    include 'mainpage.php';

    echo $variable;
    ?&gt;
</code></pre>

<p>But I cant do this without also calling the function. </p>
