---
title: getElementsById
---

```php
getElementsById ( string $id [, int $idx = null] ) : mixed
```

| Parameter | Description
| --------- | -----------
| `id`      | Element id.
| `idx`     | Index of element to return.

Returns all elements with the specified id if `$idx` is null, or a specific one if `$idx` is a valid index.