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!

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 trial

PHP PHP Arrays and Control Structures PHP Loops Sorting Multidimensional Arrays

Is it just me or is this really complex for a beginner? Can someone explain how to filter an array in simpler terms?

I don't understand what Alena is talking about and she's moving too quickly in the video. When I google about it I'm seeing a function called: array_filter. This is not the same thing? Someone please give a clear and simple example of a filtered array.

array_filter has a broader use case vs what Alena is accomplishing in her video. Using array_filter allows you to pass an array and a callback function that that array will be passed through. A theoretical use case in the context of the video, it that the sorting functionality Alena wrote gets put into a function you define and then rather than having a big messy file of procedural code, you can just reference the function with the sorting logic in what would hopefully be more structural code.

4 Answers

Completely agree. PHP isn't even my first programming language and I'm wondering what on earth is going on.

Was going to say the same thing

I agree with the comments above. This video is impossible to follow. I am sure this is an example of a very accomplished and capable coder (Alena) doing something really cool but it is introducing new stuff left right and centre, not explaining at all well the relationship between the various parts of the code or the terminology. The constant interchangeability of the variables, id, item, and whether they are a key or a value, how the values from list array used in one of the foreach loops becomes the key in the other, all of the html table syntax making harder to see the wood for the trees. This is too much for the target audience.

Ker Sing Tan
Ker Sing Tan
10,573 Points

Same here. Super confused now. I cant catch what Alena talking about. The way of explanation just does not make thing clear for a beginner

Yes, I also think that is lesson is not suitable for beginners. I'm not a huge fan of PHP's syntax due to its lack of elegance.