Get Current PHP version in String Format in PHP Script

To check the current version of PHP inside a PHP script we can use the below code. In this, we are using a predefined PHP constant "PHP_VERSION" which will return a string of the currently running PHP version.

<?php var_dump(PHP_VERSION); // returns string(7) "7.1.1-1" ?>

About Me
aman-jaiswal-image
Hello! I'm Aman Jaiswal, a web developer passionate about building efficient and reliable web applications. I specialize in PHP and Laravel development and have experience working with clients worldwide through freelance platforms. I enjoy solving real-world problems, customizing web solutions, and continuously learning new technologies in the web development ecosystem.
Let's Discuss Your Project
Prefer email? Contact me directly at contact@amanjaiswal.in