1 Vote Vote

PHP code refactoring

Posted by topdog 472 days ago Questions| start refactoring php All

How would you refactor something like this:

$start = $_GET['s'];
if (!is_int($start) || $start < 0)
{
    $start = 0;
}

Here I need start to equal 0 or greater, however later on I will need it to equal 1 or greater. How would this be made into a function?

Originally asked by: user565031 on Stack Overflow

Discuss Bury


Who Voted for this Question