I spent a few hours raging with this function and hitting my head on the desk trying to get it to load a public PEM key.
This function can leave errors in openssl_error_string even if it succeeded so this can cause a lot of confusion further down. Especially if you're prototyping and haven't put full checks on return values in yet. The error will not be cleared either when calling other functions successfully.
To avoid confusion, you should always check the return result and only call openssl_error_string after calling an openssl function that returned failure (false).