如果是isset Session,则用一行添加到$ variable或$ variable ='0'

I have php code below and I want it to use inline(one line). It should not repeat the $_SESSION name

$view = if (isset($_SESSION['Clients-view'])){
$view = $_SESSION['Cients-view'];
}
else{
$view = '0';
}

As you see it repeats $view three times and $_SESSION two times. I want it to write in a simple manner with single line.

Hope you understand the question.

Thank You,

SL

You want this:

$view = isset($_SESSION['Clients-view']) ? $_SESSION['Cients-view'] : '0';

What I don't understand is, why in your code you have $view = if (... ? If do not have a return value.