User-Defined PHP Functions

Home » Tutorials » PHP » User-Defined PHP Functions
In this lesson we shortly will consider writing custom functions. Who watched this lesson, you wouldn’t know something new. But this lesson needs because very soon we will write a lot of our custom functions.
Function declaration in php begins from function keyword. Next function name follows and parameters in brackets. Function can work without parameters. In braces there is function body.

Code lesson

<?php

function myFunc($name="Камиль") {
	echo "<h1>hello $name</h1>";
}


myFunc();

echo $name;

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

Pin It on Pinterest

Share This