PHPackages                             windwalker/compare - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. windwalker/compare

ActiveWindwalker-package[Framework](/categories/framework)

windwalker/compare
==================

Windwalker Compare package

3.5.23(6y ago)05.8k4LGPL-2.0-or-laterPHPPHP &gt;=7.1.3

Since Feb 28Pushed 2y ago3 watchersCompare

[ Source](https://github.com/windwalker-io/compare)[ Packagist](https://packagist.org/packages/windwalker/compare)[ Docs](https://github.com/ventoviro/windwalker-compare)[ RSS](/packages/windwalker-compare/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (1)Versions (87)Used By (4)

Windwalker Compare
==================

[](#windwalker-compare)

What is Compare
---------------

[](#what-is-compare)

Sometimes we will need a dynamic compare interface, but it hard to convert `=` or `= 1` string. This is easy to integate into query string.

```
$conditions = array(
    GteCompare('published', '1'),
    EqCompare('entry_id', 25),
    LteCompare('date', $query->quote($date))
);

$sql = 'WHERE ' . implode(' AND ' , $conditions);
```

We will get this string: `WHERE published >= 1 AND entry_id = 25 AND data compare();

var_dump($result); // bool(true)
```

Available Compare Object
------------------------

[](#available-compare-object)

NameDescriptionOperatorEqCompareEqual`=`NeqCompareNot Equal`!=`GtCompareGreater than`>`GteCompareGreater than or Equal`>=`LtCompareLess than`
