Title: WP_HTML_Span::__construct
Published: March 29, 2023
Last modified: February 24, 2026

---

# WP_HTML_Span::__construct( int $start, int $length )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#wp--skip-link--target)

Constructor.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#parameters)󠁿

 `$start`intrequired

Byte offset into document where replacement span begins.

`$length`intrequired

Byte length of span.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#source)󠁿

    ```php
    public function __construct( int $start, int $length ) {
    	$this->start  = $start;
    	$this->length = $length;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/html-api/class-wp-html-span.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/html-api/class-wp-html-span.php#L52)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/html-api/class-wp-html-span.php#L52-L55)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_HTML_Processor::insert_virtual_node()](https://developer.wordpress.org/reference/classes/wp_html_processor/insert_virtual_node/)`wp-includes/html-api/class-wp-html-processor.php` |

Inserts a virtual element on the stack of open elements.

  | 
| [WP_HTML_Processor::create_fragment_at_current_node()](https://developer.wordpress.org/reference/classes/wp_html_processor/create_fragment_at_current_node/)`wp-includes/html-api/class-wp-html-processor.php` |

Creates a fragment processor at the current node.

  | 
| [WP_Block_Processor::get_span()](https://developer.wordpress.org/reference/classes/wp_block_processor/get_span/)`wp-includes/class-wp-block-processor.php` |

Returns the span representing the currently-matched delimiter, if matched, otherwise `null`.

  | 
| [WP_HTML_Processor::seek()](https://developer.wordpress.org/reference/classes/wp_html_processor/seek/)`wp-includes/html-api/class-wp-html-processor.php` |

Moves the internal cursor in the HTML Processor to a given bookmark’s location.

  | 
| [WP_HTML_Tag_Processor::parse_next_attribute()](https://developer.wordpress.org/reference/classes/wp_html_tag_processor/parse_next_attribute/)`wp-includes/html-api/class-wp-html-tag-processor.php` |

Parses the next attribute.

  | 
| [WP_HTML_Tag_Processor::set_bookmark()](https://developer.wordpress.org/reference/classes/wp_html_tag_processor/set_bookmark/)`wp-includes/html-api/class-wp-html-tag-processor.php` |

Sets a bookmark in the HTML document.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_html_span/__construct/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.2.0](https://developer.wordpress.org/reference/since/6.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_html_span%2F__construct%2F)
before being able to contribute a note or feedback.