<?php 
class Door
{
    public function __construct()
    {
    }
    public function test(){
        echo "welocme";
    }
}
$obj=new Door();
get_data();
function get_data(){
$obj->test();
}
$obj->test(); work well outside function but i need inside function. I cannot access object inside function show error
Fatal error: Call to a member function test()
 
    