The command will Uninstall Any of the PHP 8.X versions of PHP installed on your Server. Now we need to cleans obsolete deb-packages to do so we need to run autoclean command.
sudo apt-get purge php8.*
Now we need to cleans obsolete deb-packages to do so we need to run autoclean command.
sudo apt-get autoclean
remove orphaned packages that are no longer needed from the system so run autoremove command just like this.
sudo apt-get autoremove