You will need to assign the return code to a variable. If you write
code:
readvalue('HKEY_CURRENT_USER\Whatever','test')

then the return code of the readvalue function will be displayed in the output window. If you write
code:
$retcode=readvalue('HKEY_CURRENT_USER\Whatever','test')

then the return code will be assigned to the variable $retcode and you can use the return code to check whether your command was successful.
_________________________
There are two types of vessels, submarines and targets.