calling a function from another file
Moderator: General Moderators
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
calling a function from another file
lets say i have 3 functions in file b. In file a i would like to call the first function from file b. can this be done. if so can i have an example please.
-
jim.barrett
- Forum Newbie
- Posts: 20
- Joined: Tue Mar 01, 2011 5:47 am
Re: calling a function from another file
This is done by including the file that contains the functions on the page where you want to call the functions.
...add a line like this to fileA.php and you can call any function from the other file. Of course, your include has to happen before the function can be called (closer to the top of the page).
Is this what you were looking for?
Code: Select all
<?php
include("fileB.php");
?>
Is this what you were looking for?
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: calling a function from another file
yes just what i was looking for. php seems easy to learn. thank you.