SMF PHP error... Am I missing something subtle in the PHP language syntax?



Given these two code snippets, the first generates errors, the second
doesn't...

// generates errors
$tboard = $context['linktree'][2]['name'];
$tboard = empty($tboard)?'':' - '.$tboard;
$ttopic = $context['linktree'][3]['name'];
$ttopic = empty($ttopic)?'':' - '.$ttopic;
if (! ereg($context['forum_name'], $context['page_title']))
$context['page_title'] = $context['linktree'][0]['name'].$tboard.
$ttopic;

// no errors
$tboard = empty($context['linktree'][2]['name'])?'':' - '.
$context['linktree'][2]['name'];
$ttopic = empty($context['linktree'][3]['name'])?'':' - '.
$context['linktree'][3]['name'];
if (! ereg($context['forum_name'], $context['page_title']))
$context['page_title'] = $context['linktree'][0]['name'].$tboard.
$ttopic;


Here's a few sample errors that I see in my SMF log only when using
the first version of the code. I think the "2" and "3" referred to
are the subscripts in the code snippet...


8: Undefined offset: 3
File: /home/xxxxxx/public_html/forums/Themes/default/
Admin.template.php (main_above sub template - eval?)
Line: 66

8: Undefined offset: 2
File: /home/xxxxxx/public_html/forums/Themes/default/
Admin.template.php (main_above sub template - eval?)
Line: 64


For the life of me, I cannot figure out the first block of code
generates errors. Am I missing something subtle about the PHP syntax?
.