Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Foreach_.php

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

Foreach_

Namespace

PhpParser\Node\Stmt

Code

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'] ?? [];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal