code: public static function MMULT($matrixData1, $matrixData2)
      {
          $matrixAData = $matrixBData = [];
          if (!is_array($matrixData1)) {
              $matrixData1 = [[$matrixData1]];
          }
          if (!is_array($matrixData2)) {
              $matrixData2 = [[$matrixData2]];
          }
  
          try {
              $rowA = 0;
              foreach ($matrixData1 as $matrixRow) {
                  if (!is_array($matrixRow)) {
                      $matrixRow = [$matrixRow];
                  }
                  $columnA = 0;
                  foreach ($matrixRow as $matrixCell) {
                      if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
                          return Functions::VALUE();
                      }
                      $matrixAData[$rowA][$columnA] = $matrixCell;
                      ++$columnA;
                  }
                  ++$rowA;
              }
              $matrixA = new Matrix($matrixAData);
              $rowB = 0;
              foreach ($matrixData2 as $matrixRow) {
                  if (!is_array($matrixRow)) {
                      $matrixRow = [$matrixRow];
                  }
                  $columnB = 0;
                  foreach ($matrixRow as $matrixCell) {
                      if ((!is_numeric($matrixCell)) || ($matrixCell === null)) {
                          return Functions::VALUE();
                      }
                      $matrixBData[$rowB][$columnB] = $matrixCell;
                      ++$columnB;
                  }
                  ++$rowB;
              }
              $matrixB = new Matrix($matrixBData);
  
              if ($columnA != $rowB) {
                  return Functions::VALUE();
              }
  
              return $matrixA->times($matrixB)->getArray();
          } catch (PhpSpreadsheetException $ex) {
              return Functions::VALUE();
          }
      }
docs: MMULT.
  
  @param array $matrixData1 A matrix of values
  @param array $matrixData2 A matrix of values
  
  @return array