Reputation:
Quick question hopefully, more curious of neatness than a problem here.
I am wanting to change a variable to another value only if the other value is, for example, larger than the original...
Eg.
if ($x < $y) $x = $y;
Or a neater way of doing this seems to be:
$x = max($x, $y);
My question is, is this (the latter) the best way. Or is there a neater way? Thanks, S
Upvotes: 1
Views: 53
Reputation: 98
The quicker and neatest method is:
$x = max($x, $y);
hope it answered your question
Upvotes: 2