473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Write a function in a seperate place and call it in several php files

Hello all,

Since I need call a function in different php files, I want to put the
funcion in a seperate file instead of copying and pasting into each php
file.

The benefit is that when I change the function in one place, all the
programs will change when they call this function.

What should I do in the PHP?

Thanks.

Zhidian Du

May 26 '06 #1
2 1243
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

du*******@gmail.com wrote:
Since I need call a function in different php files, I want to put the
funcion in a seperate file instead of copying and pasting into each php
file. [...] What should I do in the PHP?


You should RTFM:

http://php.net/include

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

Todo el mundo quiere llegar a viejo, pero nadie quiere serlo.- M. Held.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEdqDo3jcQ2mg3Pc8RAtDgAJ9iYy/1W3BYMb3wLbmX2oBRa4mJQACcDLyK
OPlnmZO4GXdil/vbygAiT28=
=GvRi
-----END PGP SIGNATURE-----
May 26 '06 #2
<?php
//include functions
require_once ("lib/function1.php");
require_once ("lib/function2.php");

?>

regards,
Lorento
---
http://www.mastervb.net

May 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Troy | last post by:
Hi! I am working on a rather complicated set of html and javascript files here and am experiencing some serious IE/Netscape(Mozilla actually) incompatability issues. I have an html page that...
15
by: Viviana Vc | last post by:
How can I programatically do the equivalent of the following: cacls "C:\Program Files\test" /T /G Everyone:f ? Thanks, Viv
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
2
by: G | last post by:
Hi, I have an aspx file that has a table with a couple of grids in it that I'm using as a template to build html files(please give me guidence if there is a better way). I would like to build this...
18
by: Ed Jay | last post by:
<disclaimer>js newbie</disclaimer> My page has a form comprised of several radio buttons. I want to poll the buttons to determine which button was selected and convert its value to a string. I...
88
by: Peter Olcott | last post by:
Cab you write code directly in the Common Intermediate language? I need to optimize a critical real-time function.
6
by: Johs32 | last post by:
I get this warning: warning: incompatible implicit declaration of built-in function 'printf' because I use printf in a function that I include in a .h file that is included by other files...Do...
14
by: Jeroen | last post by:
Hi all, I've got a question about writing a library. Let me characterize that library by the following: * there is a class A which is available to the user * there is a class B that is used...
9
by: Morten Lemvigh | last post by:
Is it possible to pass a pointer to a constructor or a class definition as argument to a function? Maybe in a way similar to passing function pointers...? The function should construct a number...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.