How to auto call function in php for every other function call
<pre><code>Class test{
    function test1()
    {
        echo 'inside test1';
    }

    function test2()
    {
        echo 'test2';
    }

    function test3()
    {
        echo 'test3';
    }
}

$obj = new test;
$obj-&gt;test2();//prints test2
$obj-&gt;test3();//prints test3
</code></pre>

<p>Now my question is,</p>

<p>How can i call another function before any called function execution?
In above case, how can i auto call 'test1' function for every another function call,
so that i can get the output as,</p>

<pre><code>test1
test2
test1
test3
</code></pre>

<p>currently i am getting output as </p>

<pre><code>test2
test3
</code></pre>

<blockquote>
  <p>I cannot call 'test1' function in
  every function definition as there may
  be many functions. I need a way to
  auto call a function before calling
  any function of a class.</p>
</blockquote>

<p>Any alternative way would also be do.</p>
