Classes and Functions + Include/Require

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Wolf95
Forum Newbie
Posts: 1
Joined: Tue May 03, 2011 12:46 am

Classes and Functions + Include/Require

Post by Wolf95 »

Hello, I was wondering about php classes and functions. I was wondering how I would program classes with functions, and how I would go about calling multiple functions from the same class? Also, when I want to include a page that only has php on it do I not close the php script with the ?>?, And also how would I include files that are in a directory stored in relation to a folder, thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Classes and Functions + Include/Require

Post by Christopher »

Wolf95 wrote:Hello, I was wondering about php classes and functions. I was wondering how I would program classes with functions, and how I would go about calling multiple functions from the same class?
http://www.php.net/manual/en/language.oop5.basic.php
Wolf95 wrote:Also, when I want to include a page that only has php on it do I not close the php script with the ?>?,
You can, but you don't need to.
Wolf95 wrote:And also how would I include files that are in a directory stored in relation to a folder, thanks
To include a file above the current directory use '..' such as '../../file.php' includes a file two directory levels up from the current directory. For below the current directory just do 'dir1/dir2/file.php'. In general, it is better to user absolute paths if you can.
(#10850)
Post Reply