The question itself is already answered by El_Vanja in the comments, but given you're beginner, I'd suggest to separate the evaluation of your variables from returning the outcome of that evaluation. That way, your code would become more readable, thus more maintainable, and easier to refactor - leaving you with far more room to improve both your code and your coding abilities.
The ternary operator, for example, is best suited for one-liners, while in your case you might resort to plain ol' if
clauses. It's a pretty verbose example, but you could approach evaluating your variables more along the lines of:
function _is_compiled(&$template_path, &$compile_path) {
if (!is_file($compile_path)) {
return false;
}
$template = file($compile_path);
$matches = preg_match(
'#^<\?php /\* Template_ 1.0.0 (\d+) ([^*]+) \*/#',
array_shift($template),
$match
);
if (!$matches) {
return false;
}
if ($match[1] != filemtime($template_path)) {
return false;
}
if ($match[2] != $template_path) {
return false;
}
$USET = new UserSet;
$tmp = $USET->readSet('sttime');
if ($tmp['setuptime'] > filemtime($template_path))) {
return false;
}
return true;
}
How brief or verbose you should be is a discussion as old as coding I suppose, but one interesting take on the topic is this one: