class Test{
function Test(){
echo "FirstName";
}
function TestMe(){
echo " LastName";
}
}
$sun=new Test();
function Find($var){
$sun->TestMe(); //-----------***
echo $var;echo "<br>";
echo "Some text";
}
call_user_func('Find',$variable);
It is giving Error: at (***) line AS
Fatal error: Call to a member function on a non-object
anybody?? i am posting again becuase my previous post is not Clear
Thanks
Jen
Classes in PHP
Moderator: General Moderators
im not very good at php im a begginer but well jus tryen to help
assumin that this class u have made and the place whr u have called it are two different files i would say u jus need to require_once("test.php");
or include("test.php")
and thats it umm i hope
anywayz jus tryen to help man forgive me if im wrong
assumin that this class u have made and the place whr u have called it are two different files i would say u jus need to require_once("test.php");
or include("test.php")
and thats it umm i hope
anywayz jus tryen to help man forgive me if im wrong
Code: Select all
<?php
$sun = new Test();
function Find($var){
global $sun;
$sun->TestMe(); //-----------***
echo $var;echo "<br>";
echo "Some text";
}
?>