Calling functions from another file

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
php_wiz_kid
Forum Contributor
Posts: 181
Joined: Tue Jun 24, 2003 7:33 pm

Calling functions from another file

Post by php_wiz_kid »

Is it possible to call a function from another file which is called by require()?
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post by cactus »

Thats the whole point of include/require, they allow you to separate your code/classes etc in to descrete files/packages to be made available across your applications.

Regards,
php_wiz_kid
Forum Contributor
Posts: 181
Joined: Tue Jun 24, 2003 7:33 pm

Post by php_wiz_kid »

That's what I thought but I get an error when I try to call a function which is stored in another PHP file that I have included into the page with require().
php_wiz_kid
Forum Contributor
Posts: 181
Joined: Tue Jun 24, 2003 7:33 pm

Post by php_wiz_kid »

I found the problem. I don't have a brain.
Galahad
Forum Contributor
Posts: 111
Joined: Fri Jun 14, 2002 5:50 pm

Post by Galahad »

Could you show us some code? That may help.

Nevermind... too late.
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

php_wiz_kid wrote:I don't have a brain.
Come on, man!
You are the one ;) (like all PHP programmer) :)
php_wiz_kid
Forum Contributor
Posts: 181
Joined: Tue Jun 24, 2003 7:33 pm

Post by php_wiz_kid »

Haha! Thanks, I'm just learning how to do functions in PHP. It's exactly like C++ but my teacher confused me so much I have to start from scratch. Thanks everyone!
Post Reply