本文整理汇总了PHP中Webmozart\Expression\Expr::lessThan方法的典型用法代码示例。如果您正苦于以下问题:PHP Expr::lessThan方法的具体用法?PHP Expr::lessThan怎么用?PHP Expr::lessThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Expression\Expr
的用法示例。
在下文中一共展示了Expr::lessThan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orLessThan
public function orLessThan($value)
{
return $this->orX(Expr::lessThan($value));
}
示例2: andLessThan
public function andLessThan($value)
{
return $this->andX(Expr::lessThan($value));
}
示例3: or
<?php
use Webmozart\Expression\Expr;
use Webmozart\Expression\Logic\Disjunction;
$rulerz = (require __DIR__ . '/../bootstrap.php');
const REPETITIONS = 10000;
$dataset = [['name' => 'Joe', 'group' => 'guest', 'points' => 50], ['name' => 'Moe', 'group' => 'member', 'points' => 25], ['name' => 'Al', 'group' => 'guest', 'points' => 30], ['name' => 'Jane', 'group' => 'admin', 'points' => 75], ['name' => 'Jude', 'group' => 'vip', 'points' => 70], ['name' => 'Lucy', 'group' => 'vip', 'points' => 72]];
$rule = '(group = "guest" and points < 40) or (group = "vip" and points > 70)';
$bench = new Hoa\Bench\Bench();
$bench->rulerz->start();
foreach (range(0, REPETITIONS) as $i) {
$rulerz->filter($dataset, $rule);
}
$bench->rulerz->stop();
// Expression
$firstPart = Expr::lessThan(40, 'points')->andEquals('guest', 'group');
$secondPart = Expr::greaterThan(70, 'points')->andEquals('vip', 'group');
$expr = new Disjunction([$firstPart, $secondPart]);
$bench->expression->start();
foreach (range(0, REPETITIONS) as $i) {
$results = [];
foreach ($dataset as $row) {
if ($expr->evaluate($row)) {
$results[] = $row;
}
}
}
$bench->expression->stop();
echo $bench;
示例4: testOrX
public function testOrX()
{
$andX = new OrX(array(new LessThan(5), new GreaterThan(10)));
$this->assertEquals($andX, Expr::orX(array(Expr::lessThan(5), Expr::greaterThan(10))));
}