Defining a User Function in PHP

Q

How To Define a User Function? in PHP?

✍: FYIcenter.com

A

You can define a user function anywhere in a PHP script using the function statement like this: "function name() {...}". Here is a PHP script example on how to define a user function:

<?php 
function msg() {
  print("Hello world!\n");
}
msg(); 
?>

This script will print:

Hello world!

 

Creating Your Own Functions in PHP

⇒⇒PHP Tutorials

2016-12-28, 225👍, 0💬