how to change php version in htaccess in server

To change the PHP version for your website using an .htaccess file, you can use the AddHandler directive. Here's an example of how you can specify PHP version 7.4 in your .htaccess file:

AddHandler application/x-httpd-php74 .php

You can replace 74 with the version number of the PHP version that you want to use.

Watch a course Learn object oriented PHP

Keep in mind that this will only work if your hosting provider has enabled support for multiple PHP versions and has the desired version installed on the server. If you are not sure if this is the case, you should contact your hosting provider for assistance.