PHP - Manual: pht\Vector::__construct
2024-12-26
(PECL pht >= 0.0.1)
pht\Vector::__construct — Vector creation
Handles the creation of a new vector.
size
The size of the vector that will be created.
value
The value to initialise the empty slots in the vector to.
No return value.
Example #1 Creating a new vector
<?php
use pht\Vector;
$vector1 = new Vector(1);
$vector2 = new Vector(2, 1);
var_dump($vector1, $vector2);
以上例程会输出:
object(pht\Vector)#1 (1) { [0]=> int(0) } object(pht\Vector)#2 (2) { [0]=> int(1) [1]=> int(1) }