I have One utility Class Called emailUtility.php as follows:
<?php
class emailUtility
{
public function SendMail($subject,$body)
{
}
}
?>
I have two more class, where I want to use this SendMail Method of the emailUtility class. I have first class (Test1.php) that uses the emailUtility as below.
<?php
include("emailUtility.php")
class Test1
{
$emailUtil=new emailUtility();
$emailUtil->SendMail("","");
}
?>
Now, when i tried to use the same emailUtility class in another class on the same way, it is not working. But, when i remove the use of emailUtility from Test1, then Test2 is working fine. Not working means when browsing, no HTML is generated for other part of the code in same file as well.
<?php
include("emailUtility.php")
class Test2
{
$emailUtil=new emailUtility();
$emailUtil->SendMail("","");
}
?>
How can i use one class in multiple other classes? Also, is it so that one class can be included only once in php?