mardi 14 novembre 2017

PHP - make if statement with two statements shorter

I have the following If statement and I want to make it shorter (eg. a one liner), without writing my if statement in one line.

    if ($start + $count > $total) {
        $count = $total;
    }

Basically I want to achieve that $count + $total is never higher then $total and if this is the case I want to set $count equal to $total.

Aucun commentaire:

Enregistrer un commentaire