1<?php
2
3const STRING_PADDING = 30;
4
5function run_bcmath_tests(
6    $firstTerms,
7    $secondTerms,
8    $symbol,
9    $bcmath_function
10) {
11    $scales = [0, 10];
12    foreach ($scales as $scale) {
13        foreach ($firstTerms as $firstTerm) {
14            echo "Number \"$firstTerm\" (scale $scale)\n";
15            foreach ($secondTerms as $secondTerm) {
16                echo $firstTerm,
17                    " $symbol ",
18                    str_pad($secondTerm, STRING_PADDING),
19                    " = ",
20                    $bcmath_function($firstTerm, $secondTerm, $scale),
21                    "\n";
22            }
23            echo "\n";
24        }
25    }
26}
27