Nasıl diğer her işlevi çağrısı için php otomatik arama fonksiyonu

0 Cevap
Class test{
    function test1()
    {
        echo 'inside test1';
    }

    function test2()
    {
        echo 'test2';
    }

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

$obj = new test;
$obj->test2();//prints test2
$obj->test3();//prints test3

Şimdi benim sorum,

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,

test1
test2
test1
test3

gibi şu anda ben çıkış alıyorum

test2
test3

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.

Herhangi bir alternatif yol da mutlaka olacaktır.

0 Cevap