mini\Util\Math\Expr::matches()
Method
public
Signature
public function matches(string $op, callable|int|null $left = NULL, callable|int|null $right = NULL): bool
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$op |
string |
required | Documentation missing |
$left |
callable|int|null |
NULL
|
Documentation missing |
$right |
callable|int|null |
NULL
|
Documentation missing |
Returns
bool
Documentation
Structural pattern matching on expression tree
Checks if this Expr matches the given operator and operand patterns. Use null to match any value, or a specific value to match exactly.
Examples: $expr->matches('/') // is this a division? $expr->matches('/', 1, 2) // is this 1/2? $expr->matches('/', null, 2) // is this ?/2 (anything divided by 2)? $expr->matches('**', null, fn($e) => $e->matches('/', 1, 2)) // x^(1/2)?