R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

PHP Programing language

What is Function
Previous Home Next
A function is something that performs a specific task. The People write functions if they plan on doing the same task over and over again. This allows you to only write the code once and save a lot of time and space. PHP has several functions that already exist for us to use. Although they all have different uses, all functions are phrased as:

name (argument).

The name being the name of the function, and the argument being the value (s) it is using.

A function is like a subroutine. It is a predefined set of commands that are executed when the function is called. Functions can be as simple or complex as desired, and can contain other functions within themselves. In the case of PHP, some functions come preprogrammed and others you can define on your own.

How Can create a Function in PHP

function function_name ( [ argument_list....] )
[return return_value;]

For example:

<title>Creating a PHP Function</title>
<h1>Creating a PHP Function</h1>
echo "Hello sir <br>";
echo "This is a very useful website for r4r.co.in <br>";
function display()
echo "Best educational site this site name is r4r.co.in";


Previous Home Next