# evaluate

Learn how to evaluate a CQL query.

This method evaluates a [CQL query](/reference/cql) against the visitor's context in real-time.

For more information, see [Query evaluation](/reference/sdk/php/query-evaluation).

## Signature

This method has the following signature:

```php
public function evaluate(string $query, ?EvaluationOptions $options = null): mixed
```

This method returns the result of the evaluation, whose type depends on the query. If the request fails and no fallback is set, it throws an [exception](/reference/sdk/php/api/exceptions/croct-exception).

## Example

Here is a basic example of how to use this method:

```php
<?php
use Croct\Plug\Croct;

$croct = Croct::fromDotenv();
$returning = $croct->evaluate('user is returning');
```

## Parameters

The following list describes the supported parameters:

- `query`: `string`

  The [CQL query](/reference/cql) to evaluate.

- `options`: [`EvaluationOptions`](/reference/sdk/php/api/options/evaluation-options) (optional)

  The evaluation options, such as a fallback or attributes.
