3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lines = array( // INCLUDE: No closing tag. 'INCLUDE' => '<esi:include src="http://example.com/1.html" alt="http://bak.example.com/2.html"/>', 'INLINE opening' => '<esi:inline name="URI" fetchable="{yes | no}">', 'INLINE closing' => '</esi:inline>', 'CHOOSE opening' => '<esi:choose>', 'CHOOSE closing' => '</esi:choose>', 'WHEN opening' => '<esi:when test="...">', 'WHEN closing' => '</esi:when>', 'OTHERWISE opening' => '<esi:otherwise>', 'OTHERWISE closing' => '</esi:otherwise>', 'TRY opening' => '<esi:try>', 'TRY closing' => '</esi:try>', 'ATTEMPT opening' => '<esi:attempt>', 'ATTEMPT closing' => '</esi:attempt>', 'EXCEPT opening' => '<esi:except>', 'EXCEPT closing' => '</esi:except>', 'COMMENT' => '<esi:comment text="the following animation will have a 24 hr TTL." />', 'REMOVE opening' => '<esi:remove>', 'REMOVE closing' => '</esi:remove>', 'VARS opening' => '<esi:vars>', 'VARS closing' => '</esi:vars>', ); foreach ( $lines as $type => $line ) { preg_match( '%^<\s*(/\s*)?((?:esi:)?[a-zA-Z0-9-]+)([^>]*)>?$%', $line, $matches ); $slash = trim( $matches[1] ); $elem = $matches[2]; $attrlist = $matches[3]; echo "$type:\n"; echo "Original: '$line'\n"; echo "Slash: '$slash'\n"; echo "Elem: '$elem'\n"; echo "Attr List: '$attrlist'\n"; echo "\n"; }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
INCLUDE: Original: '<esi:include src="http://example.com/1.html" alt="http://bak.example.com/2.html"/>' Slash: '' Elem: 'esi:include' Attr List: ' src="http://example.com/1.html" alt="http://bak.example.com/2.html"/' INLINE opening: Original: '<esi:inline name="URI" fetchable="{yes | no}">' Slash: '' Elem: 'esi:inline' Attr List: ' name="URI" fetchable="{yes | no}"' INLINE closing: Original: '</esi:inline>' Slash: '/' Elem: 'esi:inline' Attr List: '' CHOOSE opening: Original: '<esi:choose>' Slash: '' Elem: 'esi:choose' Attr List: '' CHOOSE closing: Original: '</esi:choose>' Slash: '/' Elem: 'esi:choose' Attr List: '' WHEN opening: Original: '<esi:when test="...">' Slash: '' Elem: 'esi:when' Attr List: ' test="..."' WHEN closing: Original: '</esi:when>' Slash: '/' Elem: 'esi:when' Attr List: '' OTHERWISE opening: Original: '<esi:otherwise>' Slash: '' Elem: 'esi:otherwise' Attr List: '' OTHERWISE closing: Original: '</esi:otherwise>' Slash: '/' Elem: 'esi:otherwise' Attr List: '' TRY opening: Original: '<esi:try>' Slash: '' Elem: 'esi:try' Attr List: '' TRY closing: Original: '</esi:try>' Slash: '/' Elem: 'esi:try' Attr List: '' ATTEMPT opening: Original: '<esi:attempt>' Slash: '' Elem: 'esi:attempt' Attr List: '' ATTEMPT closing: Original: '</esi:attempt>' Slash: '/' Elem: 'esi:attempt' Attr List: '' EXCEPT opening: Original: '<esi:except>' Slash: '' Elem: 'esi:except' Attr List: '' EXCEPT closing: Original: '</esi:except>' Slash: '/' Elem: 'esi:except' Attr List: '' COMMENT: Original: '<esi:comment text="the following animation will have a 24 hr TTL." />' Slash: '' Elem: 'esi:comment' Attr List: ' text="the following animation will have a 24 hr TTL." /' REMOVE opening: Original: '<esi:remove>' Slash: '' Elem: 'esi:remove' Attr List: '' REMOVE closing: Original: '</esi:remove>' Slash: '/' Elem: 'esi:remove' Attr List: '' VARS opening: Original: '<esi:vars>' Slash: '' Elem: 'esi:vars' Attr List: '' VARS closing: Original: '</esi:vars>' Slash: '/' Elem: 'esi:vars' Attr List: ''

preferences:
110.33 ms | 420 KiB | 5 Q