I think you misread the question kudose, by quite a long way. Infact, did you read the question at all? tuf a function like this would be pretty useless. Have a look at this situation and think what the output would be if your function was placed at point 1.
<?php
//point 1
if($_GET['value']=='true') {
?>true<?php
} else {
?>false<?php
}
?>
see what I mean?
Your best bet is to write something in to your error handling functions.
HTH
Bubble