mercredi 18 juillet 2018

Change ? into if statement

Hi in a piece of code on internet I found something what I want to use, but there is a question mark in it as a if/else statement. I want to replace the ? with the if/else statement in my code.

  $median = (count($athleticsArr) % 2 == 0) ? (($athleticsArr[(count($athleticsArr) / 2) - 1] + $athleticsArr[(count($athleticsArr) / 2)]) / 2) : ($athleticsArr[floor(count($athleticsArr) / 2)]);

Aucun commentaire:

Enregistrer un commentaire