PHP Function

PHP Continue Previous Next


A function is a block of statements tha can be used repeatedly in a program which is used to accomplish a task.

PHP has more than 1000 built-in functions.

A function name can start with a letter or underscore and are not case-sensitive.

A function in PHP starts with the keyword function and is not executed unless it is explicitly called.

Syntax


function functionName(){ //code to be exexcuted }

Here is the code of php function.

Filename: php / function.php


Code
<?php
//Defining function
function todayDate(){
    echo "Today is ".date('d/m/Y');
}
//Calling function
todayDate();
?>

Running Step.


Type Url - https://localhost/php/function.php


Tags: PHP


Was this helpful ?

Related Code


Popular Code

Latest Code