Since this function can be used to load a PEM encoded string also, those that are using it relying on user input should be sure to check that the passed data is indeed a PEM encoded string and not a malicious file path.
The following should be sufficient.
<?PHP
$private = trim($_POST['private']);
if (strpos($private, '-----') !== 0) return false;
?>