> For the complete documentation index, see [llms.txt](https://venndev.gitbook.io/vapm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://venndev.gitbook.io/vapm/system/setinterval.md).

# 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()`**](/vapm/system/settimeout.md), it also has a function to delete its scheduler.

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

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