---
title: getElementsByTagName
---

```php
getElementsByTagName ( string $name [, int $idx = null ] ) : mixed
```

| Parameter | Description
| --------- | -----------
| `name`    | Tag name.
| `idx`     | Index of the element to return.

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