Hi

I have been going through a tutorial i came across online. Please let me know what this would read if it wasn't written in shorthand. Regards

$products = isset($_SESSION['products']) ? $_SESSION['products'] : array();

Recommended Answers

All 3 Replies

That's an IF statement:

if(isset($_SESSION['products']))
{
    $products = $_SESSION['products']; 
} else {
    $products = array();
}

Or

$products = array();
if(isset($_SESSION['products']))
{
    $products = $_SESSION['products']; 
}
commented: Legend +1

Thank you very much. Even my lecturer didn't know lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.