PHP code example of codecounter / versionmatcher

1. Go to this page and download the library: Download codecounter/versionmatcher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codecounter / versionmatcher example snippets




// produce `false`
\CodeCounter\VersionMatcher::test('ver >= 1.2.0', array(
    'ver' => '1.1.0'
));

// produce `true`
\CodeCounter\VersionMatcher::test('ver >= 1.2.0 && ver < 1.6.0', array(
    'ver' => '1.3.0'
));

$matcher = new \CodeCounter\VersionMatcher(array(
    'android' => '1.3.0',
    'ios' => ''
));
// produce `true`
$matcher->match('ios >= 1.4.0 || android >= 1.3.0');
// produce `false`
$matcher->match('ios >= 1.4.0 || android < 1.2.0');