Ad
  • Default User Avatar

    In addition to what @Dec0y-jb said, It's also takes advantage of what PHP considers "truthy" and "falsey". To learn more about what PHP considers "true", see the truth table in the documentation.
    http://php.net/manual/en/types.comparisons.php

    Here, the code array_sum($a) % 2 returns an integer number. If it returns any number other than 0, the ternary operator sees it as a "true" condition, thereby returning the first value. However, if it returns exactly 0, the ternary operator sees it as a "false" condition, returning the second value.

  • Custom User Avatar

    The sort flag is optional, but defaults to SORT_REGULAR

  • Custom User Avatar

    Yes, pretty sure that is a rounding problem. Try to change the order of the multiplication and the division.

  • Custom User Avatar

    I'm tring to figure out the point of your comment.

    Are you trying to boast that your a better programmer than me, that's very likely, this is only a hobby for me, I'm likely a better forklift driver than you.

    Are you trying to say that I didn't need to post this comment, if so, I hope you understand the irony of posting a pointless comment to point out a pointless comment.

    Or are you just trying to push points about things I already knew?

  • Custom User Avatar

    I've never understood these ternery operators :/

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I have a same problem with JS,I just stuck on the case :Test.assert_equals(michael_pays(5), 3.33). Can you please fix it?

  • Custom User Avatar

    Im stucked with my solution. It currently passes all the tests except 1 or 2 depending on the random tests. My solution and the expected one only differs in the second decimal digit (i.e 10.02 expecting 10.03). Could it be because of round function?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution