tags:

views:

83

answers:

4

I have to find out the earliest PHP4 version my code will run under (I already know it runs on PHP5 and on PHP 4.4.9 (the last PHP4 version -- included in MAMP).

Are there code inspection tools that will do this? Do I need to install each PHP version and see what happens :-)

A: 

I don't think there is a tool for that. I guess you don't have to install all PHP version, try major releases, like 4.1, 4.2, 4.3, etc To my mind minor releases don't have language syntax changes or anything major, usually it's bug fixes

Alexandru Luchian
+1  A: 

Before you manually download and install various versions of PHP, try to download the XAMPP versions, that have the old php binaries packaged:

Download links on oldapps.com

Cassy
I think the best answer is to use the Pear component but it would be wise to then take that min version via XAMPP and actually verify the code works.
TravisO
+8  A: 

There is a PEAR package for this: PHP_CompatInfo

Find out the minimum version and the extensions required for a piece of code to run

Example: http://pear.php.net/manual/en/package.php.php-compatinfo.basic.php

powtac
This is a great answer, but I would also suggest after you find out that version, take Cassy's advice and use an install of that PHP and verify that version really works.
TravisO
A: 

I use (unit) tests for this purpose.

for v in $versions; do
  php$v -f tests.php
done
just somebody