Home  >  Article  >  Backend Development  >  How many functions does php have?

How many functions does php have?

(*-*)浩
(*-*)浩Original
2019-10-12 11:33:243489browse

The real power of PHP comes from its functions: it has over 1000 built-in functions.

How many functions does php have?

PHP User-Defined Functions

In addition to the built-in PHP functions, we can create Our own functions. (Recommended learning: PHP video tutorial)

Function is a block of statements that can be used repeatedly in the program.

The function will not be executed immediately when the page is loaded.

Function will only be executed when called.

Function names can start with letters or underscores (not numbers).

Create user-defined functions in PHP

User-defined function declarations begin with the word "function":

Note: Function names are not case sensitive.

Tip: The function name should reflect the task performed by the function.

In the following example, we create a function named "writeMsg()". An opening brace ({) indicates the beginning of a function's code, while a closing brace (}) indicates the end of the function. This function outputs "Hello world!". To call this function, just use the function name:

Example:

<?php
function sayHi() {
  echo "Hello world!";
}
sayhi(); // 调用函数?>



The above is the detailed content of How many functions does php have?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn