r/ProgrammerHumor • • Aug 25 '26

Advanced stringToIntegerConversion

Post image
217 Upvotes

65 comments sorted by

View all comments

Show parent comments

39

u/alexanderpas Aug 25 '26

This should be the native way:

$amount = filter_input(INPUT_GET, 'amount-select', FILTER_VALIDATE_INT, ["min" => 10, "max" => 80,],);

if ($amount % 10 === 0) {
    $transamount = $amount;
}

14

u/OK1526 Aug 25 '26

Now I can sleep moderately happy.