$php_errormsg does not contain the error message generated inside a function. See the example below:
<?php
@strpos();
function checkErrormsg()
{
    global $php_errormsg;
    echo "First Error is: $php_errormsg <br />";
    @ini_set();
    echo "Error is: $php_errormsg";
}
checkErrormsg();
?>
This will output:
First Error is: strpos() expects at least 2 parameters, 0 given 
Error is: strpos() expects at least 2 parameters, 0 given