# tablepress/3.4/libraries/vendor/PhpSpreadsheet/Calculation/LookupRef/Vstack.php

TablePress – Tables in WordPress made easy, version 3.4. 44 lines.

- Page: https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/Calculation/LookupRef/Vstack.php
- Raw: https://pluginprobe.com/plugins/tablepress/3.4/raw/libraries/vendor/PhpSpreadsheet/Calculation/LookupRef/Vstack.php
- Modified: 2026-09-30T03:50:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tablepress/3.4/code/libraries/vendor/PhpSpreadsheet/Calculation/LookupRef/Vstack.php#L10-L20`.

```php
<?php

namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\LookupRef;

use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;

class Vstack
{
	/**
				 * Excel function VSTACK.
				 *
				 * @return mixed[]
				 * @param mixed ...$inputData
				 */
				public static function vstack(...$inputData)
	{
		$returnMatrix = [];

		$columns = 0;
		foreach ($inputData as $matrix) {
			if (!is_array($matrix)) {
				$count = 1;
			} else {
				$count = count(reset($matrix)); //* @phpstan-ignore argument.type (reset can theoretically return mixed not array)
			}
			$columns = max($columns, $count);
		}

		foreach ($inputData as $matrix) {
			if (!is_array($matrix)) {
				$matrix = [$matrix];
			}
			foreach ($matrix as $row) {
				if (!is_array($row)) {
					$row = [$row];
				}
				$returnMatrix[] = array_values(array_pad($row, $columns, ExcelError::NA()));
			}
		}

		return $returnMatrix;
	}
}

```
