mercredi 4 mars 2020

Need to write a PHP function. Confusion

Write a function in PHP, which receives $number and has the next logic: a) it prints "foo" if number is dividable by 2 b) it prints "bar" if number is dividable by 7 c) it prints "foobar" if $number is dividable by 14 d) it prints number value for other cases e) number is a positive integer number

That is what they ask, what confuses, in my logic if number equals 14 it should print "foobarfoobar". Should I just use if statements?

Aucun commentaire:

Enregistrer un commentaire