Skip to content

Instantly share code, notes, and snippets.

@karloscarweber
Last active August 29, 2015 13:56
Show Gist options
  • Save karloscarweber/8830520 to your computer and use it in GitHub Desktop.
Save karloscarweber/8830520 to your computer and use it in GitHub Desktop.
_islegit() checks if a variable is set and not empty. eliminates a lot of extra code in the long run. Seems kinda silly if you just take it as it is.
<?php
/*
Checks if something is set and not empty
Pass the variable as a reference to truly check its
legitness.
*/
function _islegit(&$variable = null)
{
if($variable) {
if(isset($variable) && !empty($variable) ) {
return true;
} else {
return false;
}
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment