openssl_public_encrypt

Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Encrypts data with public key
<?php openssl_public_encrypt(    string $data,    string &$encrypted_data,    OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key,    int $padding = OPENSSL_PKCS1_PADDING): bool