function Foreach_::__construct
Constructs a foreach node.
Parameters
Node\Expr $expr Expression to iterate:
Node\Expr $valueVar Variable to assign value to:
array{: keyVar?: Node\Expr|null, byRef?: bool, stmts?: Node\Stmt[], } $subNodes Array of the following optional subnodes: 'keyVar' => null : Variable to assign key to 'byRef' => false : Whether to assign value by reference 'stmts' => array(): Statements
array<string, mixed> $attributes Additional attributes:
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Node/ Stmt/ Foreach_.php, line 34
Class
Namespace
PhpParser\Node\StmtCode
public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->expr = $expr;
$this->keyVar = $subNodes['keyVar'] ?? null;
$this->byRef = $subNodes['byRef'] ?? false;
$this->valueVar = $valueVar;
$this->stmts = $subNodes['stmts'] ?? [];
}