KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a doubt in php foreach iteration. Please look my below code. CODE : $arr=array(1,2,3); echo '$arr value : '. $arr; echo '<br>'; foreach($arr as $arr){ echo $arr.'<br>'; } echo '$arr value : '. $arr; OUTPUT : $arr value : Array 1 2 3 $arr value : 3 While iterating array i used same array name to value key foreach($arr as $arr) but it works fine. How it is working?. Why it doesn't override the array value while iterating? I want to know how foreach iteration is working. Please Help me! Thanks in advance Logan
Tags (comma-separated)
Save Edits
Cancel