What is the PHP equivalent function for Excel's RMZ function for regular payments?

To calculate the equal periodic payments required to amortize a loan or investment with a constant interest rate, Excel's RMZ function is commonly used. In PHP, you can achieve the same result using the `PMT` function from the `Financial` class in the `PhpOffice\PhpSpreadsheet` library.

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

// Include the autoload.php file from PhpSpreadsheet library
require 'vendor/autoload.php';

// Create a new Spreadsheet object
$spreadsheet = new Spreadsheet();

// Get the active sheet
$sheet = $spreadsheet->getActiveSheet();

// Set the loan amount, interest rate, and number of periods
$loanAmount = 10000;
$interestRate = 0.05;
$numberOfPeriods = 12;

// Calculate the equal periodic payment using PMT function
$equalPayment = -\PhpOffice\PhpSpreadsheet\Calculation\Financial::PMT($interestRate, $numberOfPeriods, $loanAmount);

// Output the result
echo "Equal periodic payment: $equalPayment";