How to Check PHP Version

In development of the website, you will be wanting to know which php version you are using to develop the system. You can check the php version by writing one line code. As well as, you can check what php version is installed on your local machine by using Terminal or Command Prompt.



Method: 1 Display the php version in web browser

Step 1: Open The text editor

Step 2: Write or Copy/Paste this following code in the .php extension file

<?php
echo 'Current PHP version: ' . phpversion();
?>

After that, save the file and run the file

Create a detailed information of the PHP

This is report you can easily get the detailed report of the php extension, version, commands and more.

<?php 
phpinfo();
?>

Method: 2 Local PHP version

If you have installed the php locally in the system, you can use the Terminal or Command Prompt to check the version.

Step 1 : Open the Command Prompt or Terminal.

Step 2 : Enter the following command to check the version

php -v
Posted in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *