1Foreach loop 2----- 3<?php 4 5// foreach on variable 6foreach ($a as $b) {} 7foreach ($a as &$b) {} 8foreach ($a as $b => $c) {} 9foreach ($a as $b => &$c) {} 10foreach ($a as list($a, $b)) {} 11foreach ($a as $a => list($b, , $c)) {} 12 13// foreach on expression 14foreach (array() as $b) {} 15 16// alternative syntax 17foreach ($a as $b): 18endforeach; 19----- 20array( 21 0: Stmt_Foreach( 22 expr: Expr_Variable( 23 name: a 24 ) 25 keyVar: null 26 byRef: false 27 valueVar: Expr_Variable( 28 name: b 29 ) 30 stmts: array( 31 ) 32 comments: array( 33 0: // foreach on variable 34 ) 35 ) 36 1: Stmt_Foreach( 37 expr: Expr_Variable( 38 name: a 39 ) 40 keyVar: null 41 byRef: true 42 valueVar: Expr_Variable( 43 name: b 44 ) 45 stmts: array( 46 ) 47 ) 48 2: Stmt_Foreach( 49 expr: Expr_Variable( 50 name: a 51 ) 52 keyVar: Expr_Variable( 53 name: b 54 ) 55 byRef: false 56 valueVar: Expr_Variable( 57 name: c 58 ) 59 stmts: array( 60 ) 61 ) 62 3: Stmt_Foreach( 63 expr: Expr_Variable( 64 name: a 65 ) 66 keyVar: Expr_Variable( 67 name: b 68 ) 69 byRef: true 70 valueVar: Expr_Variable( 71 name: c 72 ) 73 stmts: array( 74 ) 75 ) 76 4: Stmt_Foreach( 77 expr: Expr_Variable( 78 name: a 79 ) 80 keyVar: null 81 byRef: false 82 valueVar: Expr_List( 83 items: array( 84 0: ArrayItem( 85 key: null 86 value: Expr_Variable( 87 name: a 88 ) 89 byRef: false 90 unpack: false 91 ) 92 1: ArrayItem( 93 key: null 94 value: Expr_Variable( 95 name: b 96 ) 97 byRef: false 98 unpack: false 99 ) 100 ) 101 ) 102 stmts: array( 103 ) 104 ) 105 5: Stmt_Foreach( 106 expr: Expr_Variable( 107 name: a 108 ) 109 keyVar: Expr_Variable( 110 name: a 111 ) 112 byRef: false 113 valueVar: Expr_List( 114 items: array( 115 0: ArrayItem( 116 key: null 117 value: Expr_Variable( 118 name: b 119 ) 120 byRef: false 121 unpack: false 122 ) 123 1: null 124 2: ArrayItem( 125 key: null 126 value: Expr_Variable( 127 name: c 128 ) 129 byRef: false 130 unpack: false 131 ) 132 ) 133 ) 134 stmts: array( 135 ) 136 ) 137 6: Stmt_Foreach( 138 expr: Expr_Array( 139 items: array( 140 ) 141 ) 142 keyVar: null 143 byRef: false 144 valueVar: Expr_Variable( 145 name: b 146 ) 147 stmts: array( 148 ) 149 comments: array( 150 0: // foreach on expression 151 ) 152 ) 153 7: Stmt_Foreach( 154 expr: Expr_Variable( 155 name: a 156 ) 157 keyVar: null 158 byRef: false 159 valueVar: Expr_Variable( 160 name: b 161 ) 162 stmts: array( 163 ) 164 comments: array( 165 0: // alternative syntax 166 ) 167 ) 168) 169