How Functions work in PHP

Displaying the random function in php
Random number between 1 and 10: 4

Using the Random function in a user-defined function:
Today, I am watching Megan

How it works? (Explanation)

Functions are available in most programming languages. When programmers create functions or use predefined ones, they don't have to retype the code every time they repeat an operation. It is as simple as calling the function and including the parameters it requires to run. By retyping codes every time, bugs and syntax issues can be prevented and programming files can be smaller.

Source example for the work above:-

Example