Functions in PHP DC

Copying the same code you need to every location you need it in is neither practical nor efficient. In the latest installment for learning PHP, you learn how to build functions as well as how to use the built-in functions provided.

Local Companies

Capital Management Consulting,
(202) 527-2022
5411 13th St., NW
Washington, DC
Sophisticated Technologies, Inc.
(301) 731-1015
3311 Grayvine Lane
Washington, DC
Peyton McCall, Inc.
(202) 327-4902
7504 Alaska Ave
Washington, DC
Dantech Corporation Inc.
(888) 868-9015
1700 Verbena St., NW
Washington, DC
The Myta Corporation
(301) 468-7740
6901 Barrett Lane
Bethesda, DC
Symbiont, Inc.
(202) 887-6800
1320 Fenwick Lane
Silver Spring, DC
Enlightened, Inc.
(202) 783-4655
666 11th St., NW
Washington, DC
Evergreen Computer Services, Inc
(301) 758-2986
12421 Alamanco Way
Washington, DC
The Carrington Group, Inc
(202) 726-4441
1818 New York Ave., NE Suite 115
Washington, DC
NGEN, LLC
(301) 531-9700
1101 Mercantile Lane
Washington, DC

provided by: 
Originally published at Internet.com


A complete PHP application might contain upwards of dozens of individual script files, with hundreds of lines of code in each. Between all of those, there will be many instances where the same piece of code is reused: something as simple as outputting a string to the browser or as complex as making sure a user is logged in across multiple pages, and prompting them for login information if they are not.

As you might imagine, copying the same code you need to every location you need it in is neither practical nor efficient.

Fortunately PHP, like most other programming languages, includes a language structure called a Function. A Function is a self-contained code block that performs a specific job. In most cases, they accept input from the main script as arguments, and return some kind of result. They can help modularize a script by allowing the programmer to break the script down by task. They are also portable, so if you write a useful function for one script, you can easily reuse it in another.

In this article, we will be covering some introductory information on functions. We will also be taking a brief look at PHP's pre-defined functions before focusing on creating and using your own...

Read article at Internet.com site

Featured Local Company

Symbiont, Inc.

(202) 887-6800
1320 Fenwick Lane
Silver Spring, DC

Regional Articles
Related Local Events
DC Chamber Technology Series: Session 4
Dates: 12/10/2009 - 12/10/2009
Location: Robert H. Smith School at the Ronald Reagan Building and International Trade Center
Washington, DC
View Details

ACIs 3rd Annual Carbon Capture and Sequestration Summit
Dates: 9/14/2009 - 9/15/2009
Location: Omni Shoreham Hotel
Washington, DC
View Details

3rd Carbon Capture and Sequestration Summit
Dates: 9/14/2009 - 9/15/2009
Location: Omni Shoreham Hotel
Washington, DC
View Details

Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML