How To Define a User Function

Q

How To Define a User Function? - PHP Script Tips - Creating Your Own Functions

✍: 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!

2007-04-24, 4830👍, 0💬