Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

isset($catalog[id]);

<?php
  //inlcuding data
  include("include/data.php");
  include("include/functions.php");

if(isset($_GET["id"])){

    $id = $_GET["id"];  
    if(isset($catalog[$id])){  //what's the purpose of using isset here
        $item = $catalog[$id];
    }
 }
 if(!isset($item)){
    header("location:catalog.php");
    exit;
 }
  $p_title = $item["title"];
  $sections = null;

 include("include/header.php");

?>

1 Answer

Here's what the PHP manual (http://php.net/manual/en/function.isset.php) has to say:

Determine if a variable is set and is not NULL

By "is set" it means "has a value".

Thanks