Creating class and function is PHP is the smart way to re use code. Here is the very simple example of class creation and function declaration.
You can create a file called class_base.php
//Declare Class
class Base
{
function CheckUsers()
{
echo "Welcome to the function.";
// Some more code
}
}
How to access this function:
Create a file index.php
include_once 'class_base.php';
$user = new Base; //Initialize the class
$user->CheckUsers(); //Call the function
Will cover more advance topics in the next posts.