Define the PHP Function

Posted on Updated on

Define in briefly PHP Function

What is function and why we use the function ?

Function is the keyword which is use to reduce the line of code which repeat again and again. its reduce the line of code and as well as make site light and reduce the time to develop.

Function creates once and we can use every time every where just with call to it. We just use the function keyword and give the name of the function like add_two_values.ends with () brackets.

Syntax of the function declaration :

Function function_name()

{

Function body here we write the code which is executed;

}

Now we declare the function the next step is to call that function we can call the function where we want to call the function.

Syntax of function call:

Function_name();

We have to write the name of the function and end with the semicolon.

Where we use the function into the websites.

Like suppose we want print the time on 10 places we just create a function of date and write the code into the function and declare once and call that function where we want to show the date.

Like

Function date_oftody() // declare function

{

$date=date(‘d-m-y’);

Echo $date;

}

Date_oftody(); // call date function

We have to write only one line and we get the date.

For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.

Helpline: 9814666333, 8699444666

Email:info@technocampus.co.in

**************************************************************************************************************

Please fill the FORM and we shall contact you soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s