note 46040 added to function.include
| From: | thiago_mata at yahoo dot com dot br | Date: | Tue, 28 Sep 2004 04:47:51 +0000 |
| Subject: | note 46040 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77457@lists.php.net to get a copy of this message | ||
<?
//\\ File1.php //\\
/*
You can use the include inside of your objects functions. They will can acess another functions of
the
object, variables using the "this" command just like you would make inside the class. But
don't need more
to be that big file. The includes are just maded when they are really needed.
*/
class People
{
var $MyName = 'Bob';
function SayHello($Him)
{
print "I am enter in the say hello function <br> ";
return "<b> Hello ".$Him."! <br> </b>";
}
function Introduce()
{
print "I am enter in the introduce function <br> ";
return "<b> Hi, my name is ".$this->MyName." <br> </b>";
}
function Meet($People)
{
print "I am enter in the meet function <br> ";
//\\ Where the magic happens //\\
return include("File2.php");
}
}
$Actual = new People;
print $Actual->Meet('Bob');
print $Actual->Meet('Marie');
?>
------------------------------------------------------------------
<?
//\\ File2.php //\\
print "I am enter in the include function <br> ";
if ($People == $this->MyName)
{
return $this->Introduce();
}
else
{
return $this->SayHello($People);
}
/*
Enjoy..
":^D
Thiago Mata
*/
?>
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46040
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46040&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46040&report=yes
Search -- http://master.php.net/manage/user-notes.php