PHP tutorial bugged?

Hello i’m new here, i’m here because a recruiter sent me an evaluation link and i started to do the tutorial. But it seems that it’s bugged https://www.casimages.com/i/200728062526920027.png.html
Or maybe it’s on purpose to show you what it looks like when you’re wrong ?

Your code is buggy, so the validation tests most likely failed:

  • At the first iteration of your foreach, what is the value of $largest? Does max() make sense for this value as a parameter?

While it is not a ‘breaking’ bug, only inefficiency, I still recommend to consider:

  • why do you treat an array of a single 0 value as a separate case?
  • did you consider all possible use of max() ? (see PHP library documentation, what parameters are allowed for max)
1 Like

I see, didn’t know max() can accept array as a parameter, thanks !