@wpkernel/php-json-ast v0.12.6-beta.3
@wpkernel/php-json-ast / buildForeach
Function: buildForeach()
ts
function buildForeach(
expr,
options,
attributes?): PhpStmtForeach;Builds a PHP foreach loop statement node.
Parameters
expr
The expression to iterate over.
options
Configuration for the foreach loop (value variable, optional key variable, by reference, statements).
valueVar
byRef?
boolean
keyVar?
PhpExpr | null
stmts?
PhpStmt[]
attributes?
Readonly<Record<string, unknown>>
Optional attributes for the node.
Returns
A PhpStmtForeach node.
