Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlex Hort-Francis
12,924 PointsQuite a tortured example; you would use object-oriented programming for an application this complex!
For anyone new to PHP/programming and at a loss in this video: I expect you would be unlikely to use arrays to handle data like this, you would probably use objects. Application state would be done with booleans; type conversion between strings and booleans could introduce errors.
As long as you understand the principles behind For loops and For Each loops, and how to write them out, I think you have got what you need out of this part of the course!
1 Answer
Steven Parker
231,271 PointsConsidering that the course title begins with "PHP Arraysβ¦" the use of an array in the example seems appropriate. And remember, the examples are for illustrating the concepts being taught and will likely never be the only (or the "best") approach to a problem.
The fact that you're thinking of effective alternative strategies is evidence of your learning progress and grasp of the material. Good job!
Alex Hort-Francis
12,924 PointsAlex Hort-Francis
12,924 PointsYeah I agree; I think there is a danger of making this part of the PHP track too in-depth, bamboozling people with complicated application logic before they have learned everything they need to do practically implement or design it themselves, though. Just reassuring anyone confused who might stumble into the comments, haha..