# setInterval()

```php
/**
 * This function is used to run a callback in the event loop with interval
 */
public static function setInterval(callable $callback, int $interval): SampleMacro;
```

The **`setInterval()`** method, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.

Example:

```php
System::setInterval(function() {
    var_dump("Hello World!");
}, 1000);
```

Similar to [**`setTimeout()`**](https://venndev.gitbook.io/vapm/system/settimeout), it also has a function to delete its scheduler.

```php
$interval = System::setInterval(function() {
    var_dump("Hello World!");
}, 1000);

System::clearInterval($interval);
```
