News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Defining and Using Functions in PHP
December 01, 2011 @ 08:38:21

PHPMaster.com has a new article for those new to the PHP language posted this morning - an introduction to using functions and making your code more reusable.

Let's start by defining the word "function." A function is a self-contained piece of code which carries out a particular task (or function!). A key benefit of using functions is that they are reusable; if you have a task that needs to be performed a number of times, a function is an ideal solution. They can be either defined by you or by PHP (PHP has a rich collection of built-in functions). This article will focus on programmer-defined functions but will touch briefly on PHP's functions to complete the picture.

They include a few code snippets showing the syntax of functions (including their name, arguments and returning a value). They suggest grouping your functions together in your code for easier maintenance and share a handy tip on making a function accept a varying number of arguments.

0 comments voice your opinion now!
introduction language tutorial function syntax


blog comments powered by Disqus

Similar Posts

Alan Knowles' Blog: Getting Started with HTML_FlexyFramework, DataObjects and HTML_Template_Flexy

CodeForest.net: Translate and Localize your web application with PHP and gettext

IBM developerWorks: Understanding the Zend Framework, Part 2 (MVC & a Database)

PHPBuilder.com: Transferring Huge XML Documents in PHP with an Ajax-driven Web Interface

SitePoint PHP Blog: How to Expose PHP's Private Parts


Community Events





Don't see your event here?
Let us know!


list release application series developer framework library podcast bugfix introduction api configure project language threedevsandamaybe interview code wordpress laravel community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework