ubuntu - Why (sudo apt install php-fpm) installs Php 8.1?

one text

When i used this code on a Oracle machine which has Ubuntu 22.04, it installed PHP 8.1? Why?

sudo apt install nginx mariadb-server php-mysql php-curl php-gd php-zip php-fpm

Before i had a Debian machine on Hetzner, and when i used below code it installed PHP 7.4

sudo apt install php-fpm php-mysql -y

If i want to install PHP 7.4 what is the right code? Are there any difference between Ubuntu and Debian on this issue?

Thanks

Source