PHP不空,比较优雅

Just wondering if there is an easy way to check if a post variable is not empty and compare with x could put that in a function or use and but i more looking for a elegant way.

if( !empty( $_POST['ccc-form-login'] ) )
if( $_POST['ccc-form-login'] == 1 )
{
  //code
}

You may try this

if( isset($_POST['ccc-form-login']) ) {
    // it's set and not empty
}

But, if you want to check isset and value == 1 then try this

if( isset($_POST['ccc-form-login']) && $_POST['ccc-form-login'] == 1 ) {
    // it's set and not empty (value is 1)
}
if(!empty($_POST['ccc-form-login'] && $_POST['ccc-form-login'] == 1){
     //something
}

That would be about the simplest you could get.