wau/dynamic-comparator

此组件提供通过给定比较运算符比较两个值的功能。

2.0 2019-05-20 08:26 UTC

This package is auto-updated.

Last update: 2024-09-20 21:07:01 UTC


README

# 动态比较器 此组件提供通过给定比较运算符比较两个值的功能。

安装

您可以通过 composer 安装此包。

composer require wau/dynamic-comparator

### 使用

...
use Wau\DynamicComparator\Traits\DynamicComparator;

class ExampleClass
{

    use DynamicComparator;
    
    public function index()
    {
        $a = 10;
        $b = 20;
        
        $this->is($a, '==', $b);  // false
        $this->is($a, '>=', $b);  // false
        $this->is($a, '!==', $b); // true
        $this->is($a, '!=', $b);  // true
    }
}

...

运算符完整列表

'==' - Equal
'===' - Identical
'!=' - Not equal
'!==' - Not identical
'>' - Greater than
'<' - Less than
'>=' - Greater than or equal to
'<=' - Less than or equal to

更多信息请参见 文档。

许可证

MIT 许可证 (MIT)。请参阅 许可证文件 获取更多信息。