jchlu
3/31/2014 - 9:38 PM

Setup different PHP versions in CodeRunner

Setup different PHP versions in CodeRunner

<?php

    namespace Sausages;

    echo "PHP version: " . PHP_VERSION . PHP_EOL;

    $arr = array(
        'a' => array(
            'apples'   => 'green',
            'sausages' => 'brown',
        ),
        'b' => 'bananas',
    );

    try {
//           if(is_array($arr['a']))
             if(is_array($arr['b']))
                echo $arr['a']['sausages'];
             else
                throw new \Exception('No Sausages');
    } catch(\Exception $e) {
            echo "Error: " . $e->getMessage() . PHP_EOL;
    }
xcode-select --install
brew update
brew upgrade
brew install homebrew/versions/bison27
brew install josegonzalez/php/php53

Set the CodeRunner prefs, same php.ini different executable:

PHP /usr/bin/php -c /etc $filename

PHP53 /usr/local/bin/php -c /etc $filename

then test in different versions with the attached.