What is the difference between following functions?
Does these both functions perform same task?

$wh_ope=clean($_POST['whop'])?(int)$_POST['whop'] : 0;
$wh_ope=(int)clean($_POST['whop']); 


function clean($str)
    {
    $cstr=trim($str);
    $cstr=addslashes($str);
    $cstr=strip_tags($str);
    $cstr=htmlspecialchars($str);
    return $cstr;
    }

Neither are good code. A string is not an integer. The length may be. Any character of the string can be considered an integer, but the string itself is not. What are you trying to accomplish here?

Trying to get zero (0) if there is NULL or empty string.
Want to save 0 instead of NULL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.