All right guys, this is my answer based on your comments, now fully functional. Thanks a lot:

//pregenerate ciphers key
function prepare_key($encryption_key){
return openssl_digest($encryption_key, 'MD5', TRUE);
}
//literature manual: https://www.php.net/manual/en/function.openssl-encrypt.php
//function cipher string
function cipher_string($plaintext,$encryption_key){
$method=openssl_get_cipher_methods()[0];
$ivlen = openssl_cipher_iv_length($method);
//$iv = openssl_random_pseudo_bytes($ivlen);
$encrypted = openssl_encrypt($plaintext, $method, prepare_key($encryption_key), $options=0, substr(prepare_key($encryption_key),0,10), $tag);
return $encrypted;
}
//function to decipher string
function decipher_string($encrypted,$encryption_key){
$method=openssl_get_cipher_methods()[0];
$ivlen = openssl_cipher_iv_length($method);
//$iv = openssl_random_pseudo_bytes($ivlen);
$decrypted = openssl_decrypt($encrypted, $method, prepare_key($encryption_key), $options=0, substr(prepare_key($encryption_key),0,10), $tag);
var_dump("dumpfn:".openssl_decrypt($encrypted, $method, prepare_key($encryption_key), $options=0, $iv, $tag));
echo("<br>");
var_dump("encr:".$encrypted);
echo("<br>");
var_dump("decr:".$decrypted);
echo("<br>");
return $decrypted;
}