PHP数组 - 缺少条目

Can anyone tell me, if there is an error in the following code, please?

eval ("\$typeselectbit = \"".$cmstpl->get("admin_selectbitdefault")."\";");
$result = $cmsdb->query("SELECT * FROM cms".$n."_type WHERE deleted = '0' ORDER BY typename ASC");
while ($type = $cmsdb->fetch_array($result))
{
    $typeid = $type['typeid'];
    $typename = $type['typename'];

    eval("\$typeselectbit .= \"".$cmstpl->get(ifelse($GPC['typeid'] == $typeid, "typeselectbit2", "typeselectbit"))."\";");
}

It doesn't output the first entry from the array. But maybe the error is somewhere else.

At the moment, I'm not sure, where this problem is coming from.

What do you think? Does it look correct to you?

And if not, what do I have to fix and how exactly should it look like?

Or do I have to look somewhere else in the script?

Any specific hints, which could help to find the reason?

Thank you for your help! :)

The last line in your code eval("\$typeselectbit .= \"".$cmstpl->get(ifelse($GPC['typeid'] == $typeid, "typeselectbit2", "typeselectbit"))."\";"); has a parse error. ifelse is not valid PHP syntax (unless that is a function you have declared previously). It could also be any other number of errors occurring inside of the eval construct.

According to the manual

If there is a parse error in the evaluated code, eval() returns FALSE and execution of the following code continues normally. It is not possible to catch a parse error in eval() using set_error_handler().

It's not clear why you chose to use eval at all here, but one of the down sides, among others, is that you typically can't easily debug these kinds of errors inside of eval. If you ran this code outside of eval you'd immediately see the parse error.