To install PHP 7.2 on Ubuntu 23.10, you can use the following steps.
Step 1 : Update Package List:
Make sure your package list is up to date:

Step 2 : Add the Repository.
Ondrej's PPA doesn't support non-LTS versions of Ubuntu. Nevertheless, we can proceed with the installation by following the steps below.
Add Ondrej's PHP repository with the following command:
Press Enter to confirm.

Step 3 : Open the file '/etc/apt/sources.list.d/ondrej-ubuntu-php-mantic.sources' using a text editor.

Replace 'mantic' with 'jammy'

After making the change, save the file.
Step 4 : Run the update command again to ensure the system is aware of the changes:

Step 5 : Create a preference file for Ondrej's PHP repository by creating the file '/etc/apt/preferences.d/ondrejphp' and adding the following content:

Step 6 : Install PHP 7.2
Install PHP 7.2 along with commonly used modules:

Step 7 : Install Essential PHP Extensions

Explanation of the extensions:
- php7.2-mysql: MySQL database support.
- php7.2-curl: cURL support for making HTTP requests.
- php7.2-xsl: XSL support for XML transformations.
- php7.2-gd: GD library support for image processing.
- php7.2-common: Common files for PHP.
- php7.2-xml: XML support.
- php7.2-zip: Zip archive support.
- php7.2-soap: SOAP support.
- php7.2-bcmath: Arbitrary precision mathematics support.
- php7.2-mbstring: Multibyte string support.
- php7.2-gettext: Gettext support for internationalization.
- php7.2-imagick: ImageMagick support.
Step 8 : Check PHP Version:
After the installation is complete, you can check the PHP version with:

Now, PHP 7.2 should be installed and configured on your Ubuntu 23.10 system