<?php
/**
 * Created by backend team.
 * User: Ahmed Hamdi
 * Date: 1/11/18
 * Time: 11:27 PM
 */

# the action get from request
$action = isset($_SERVER['PATH_INFO']) ? trim($_SERVER['PATH_INFO'], '/') : '';
if (!$action) {
    $action = 'index';
}

# here call the class and function
$call_func = new pageClass();

// check if there method or not
if (method_exists($call_func, $action)) {
    $call_func->$action();
} else {
    $call_func->index();
}