Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 9th, 2006, 12:30 PM
Registered User
 
Join Date: Nov 2003
Location: , , USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default functions

I have a function that I use in multiple pages. I don't want to define the function in every page. Is there a way to include a function I made. For example:

include('function.inc');
function();

If the function is defined in function.inc, how do I make the function global so it can be defined on one page, included and used on another page?


Thanks :)
Reply With Quote
  #2 (permalink)  
Old March 10th, 2006, 02:59 AM
Registered User
 
Join Date: Nov 2003
Location: , , USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I figured it out on my own.

Solution:
I created a class and put the function in the class. I then included the class file in each page and called the function from within the class.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C functions...??? ethantinder C# 2 April 25th, 2008 02:25 AM
Functions LTello BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 3 September 15th, 2006 11:15 AM
Functions czambran BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 13 July 11th, 2006 06:33 PM
Functions Meg Intro Programming 1 January 23rd, 2006 01:03 PM
Help with Functions megabytes C# 1 August 7th, 2003 12:48 PM



All times are GMT -4. The time now is 10:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.