openssl_pkey_export_to_file
Supported Versions: PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8
Gets an exportable representation of a key into a file
<?php openssl_pkey_export_to_file( OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key, string $output_filename, ?string $passphrase = null, ?array $options = null): bool