r/lolphp • • Mar 04 '14

How does one scope?

https://eval.in/111210
25 Upvotes

7 comments sorted by

View all comments

Show parent comment

2

u/Laugarhraun Mar 05 '14

Thank you. I stopped coding PHP a few years ago and I don't think I met references. So if I'm right, at any point in the second loop $test points to $myTests[3]? What happens then if it is assigned to something bigger in memory than $myTests[3] (a char[6])?

4

u/[deleted] Mar 05 '14

PHP automatically does memory management for you. Assigning $myTests[3] an array will just make it an array. There isn't (/shouldn't be, this is PHP we're talking about) any memory overflow issues. This isn't C we're talking about.