How can I rewrite this code to improve its clarity?
Posted
by eric
on Stack Overflow
See other posts from Stack Overflow
or by eric
Published on 2010-03-27T18:21:31Z
Indexed on
2010/03/27
18:43 UTC
Read the original article
Hit count: 362
Could you write this 'cleaner' ? Just a simple question from a beginner:)
if(isset($_GET['tid']) && trim($_GET['tid'])!==""){
$act = 'tid';
$tid = trim($_GET['tid']);
}elseif(isset($_GET['fid']) && trim($_GET['fid'])!==""){
$act = 'fid';
$fid = trim($_GET['fid']);
}elseif(isset($_GET['mid']) && trim($_GET['mid'])!==""){
$act = 'mid';
}elseif(isset($_GET['act']) && trim($_GET['act'])!==""){
$act = trim($_GET['act']);
}else{
$act = "";
}
© Stack Overflow or respective owner