Thursday, September 01, 2011

On a lighter note....

I'm always happen when I can take....


if(!isset($category_id) || !(int)$category_id>0)
{
$category_id=0;
}

if(!isset($product_id) || !(int)$product_id>0)
{
$product_id=0;
}

if(!isset($remove))
{
$remove="";
}

if(!isset($active))
{
$active="";
}

if(!isset($inactive))
{
$inactive="";
}

if(!isset($action))
{
$action="";
}


...and condense it down too...


foreach(array('remove', 'active', 'inactive', 'action') as $v)
{ if(!isset($$v)) { $$v=''; } }


Writing code is therapeutic. :-)

No comments: