# getExperiment

Learn how to read the experiment that served the content.

This method gives you the [experiment](/reference/sdk/php/api/response/experiment-metadata) the visitor was assigned to.

## Signature

This method has the following signature:

```php
public function getExperiment(): ?ExperimentMetadata
```

This method returns the [experiment](/reference/sdk/php/api/response/experiment-metadata) the visitor was assigned to, or `null` when none was assigned.

## Example

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

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

$croct = Croct::fromDotenv();
$options = FetchOptions::defaults()->withSchema();
$experience = $croct->fetchContent('home-banner', $options)->getMetadata()->getExperience();
$experiment = $experience->getExperiment();
```
