Php/docs/pht-vector.construct

提供:Dev Guides
< Php
移動先:案内検索

pht\Vector::__construct

(PECL pht >= 0.0.1)

pht\Vector::__constructVector creation


説明

public pht\Vector::__construct ([ int $size = 0 [, mixed $value = 0 ]] ) : Vector

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.


例1 Creating a new vector

<?phpuse 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)
}