Checking PHP Major Version on Travis-CI

Chances are, you might want to run tests for both PHP5 and PHP7 on Travis-CI. However, you will need to install different extension version to make it compilable for PHP5 or PHP7.

And so here is the simple check using bash substr:

if [[ ${TRAVIS_PHP_VERSION:0:1} == "7" ]] ; then
... do something for php7
elif [[
${TRAVIS_PHP_VERSION:0:1} == "5" ]] ; then
... do something for php 5
fi

Here is the script that installs the APCu extension for both PHP5 and PHP7.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.