PHP Functions, PHP Functions Tutorials

Learn PHP Functions with examples.



Share on Google+Share on Google+

PHP Functions, PHP Functions Tutorials


Learn PHP Functions with examples.

PHP Functions

In this section we will understand important PHP functions with the help of example code.

What is Functions?

Function is a block of code to do some processing. The function contains the logic to do an unit of work. For example you can create function to check if an user is valid or not by passing  username and password as parameter. In the function declaration you may have to write code to connect to database and validate user.

Here is an example of custom function:

function validateUser($username,$password) {
		//Write code to connect to database and then validate user
		//if user found set the value of variable $isValidUser to true
		//finally return the $isValidUser value
                return $isValidUser;

Functions in PHP

PHP provides many built-in functions to do the real job. There are around 5000 functions available in PHP. These functions provides a lot functionalities. It helps the developers to do complex programming easily and rapidly.

Here are the list of important PHP functions with explanation and example code:

PHP Date and Time

PHP Date add days

PHP Date add 1 day

Check Date in PHP

PHP date add function

PHP date_create

PHP date_create_from_format function

The PHP Date() Function

PHP Date and Time

Eval () PHP Function, Example of Eval () PHP Function
Learn how to use Eval () PHP Function to execute PHP code.



Posted on: February 16, 2005 If you enjoyed this post then why not add us on Google+? Add us to your Circles