My PHP code looks like that.
if(isset($_GET['id'])) {
$id = $_GET['id'];
}
if(isset($_GET['subid'])) {
$subid = $_GET['subid'];
}
I want to get variable if isset and set to 0 if !isset. something like that
if(isset($_GET['id'])) {
$id = $_GET['id'];
} else $id='0';
But as you see i have multiple if's. How can i do it? I need to write else for every if?
UPDATE Ok. thx for your help. I did it. But is there any way to shorten this piece of code again?
$id = isset($_GET['id']) ? $_GET['id'] : 0;
$page = isset($_GET['page']) ? $_GET['page'] : 0;
$subid = isset($_GET['subid']) ? $_GET['subid'] : 0;
$feat = isset($_GET['feat']) ? $_GET['feat'] : 0;