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 trial

PHP Enhancing a Simple PHP Application Paginating a List: Controller Coding the get_products_count Function

Lewis Cowles
Lewis Cowles
74,902 Points

poorly explained or check not working

count() is the perfect function for checking the number of elements in an array, you even use it yourself within this code block, what on earth are your requirements for this, because if they are more than simply adding a function that works and does as you ask, you need to say that

What code are you trying to pass with?

I was able to use count()

Lewis Cowles
Lewis Cowles
74,902 Points

Hi Jason, it has let me pass now with my original code... it may have been a JS error, or maybe a temporary server glitch, but it kept saying that the function was not returning blah blah blah, coming here complaining, going back, and pasting fixed this bug... I have had various issues when completing lots of tasks before as well such as the video for completion on earlier tasks playing but not being visible... I am using the latest chrome stable

Ok, glad you got it working.

I'm not that far in the project yet but I tried this challenge and got it working with return count(get_products_all()) inside the new function they wanted you to write. Not sure if you used something similar or not.

I've been using firefox and haven't had too many hiccups with the code challenges.