3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '<iframe width="560" height="315" src="https://www.youtube.com/embed/W9k0OhJkjQ0" frameborder="0" allowfullscreen></iframe>'; $dom = new \DOMDocument( '1.0', 'UTF-8' ); // muted because malformed HTML cause warnings @$dom->loadXml( "<iframe_content>{$content}</iframe_content>" ); $domIframe = $dom->getElementsByTagName( 'iframe' ); // seems this iframe is not an iframe if ( ! $domIframe->length ) { echo 'No Iframe'; } /** @var \DOMElement $iframeNode */ $iframeNode = $domIframe->item( 0 ); $iframeNode->removeAttribute( 'width' ); $iframeNode->removeAttribute( 'height' ); echo $dom->saveHTML( $iframeNode );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/MEdVQ
function name:  (null)
number of ops:  37
compiled vars:  !0 = $content, !1 = $dom, !2 = $domIframe, !3 = $iframeNode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Ciframe+width%3D%22560%22+height%3D%22315%22+src%3D%22https%3A%2F%2Fwww.youtube.com%2Fembed%2FW9k0OhJkjQ0%22+frameborder%3D%220%22+allowfullscreen%3E%3C%2Fiframe%3E'
    5     1        NEW                                              $5      'DOMDocument'
          2        SEND_VAL_EX                                              '1.0'
          3        SEND_VAL_EX                                              'UTF-8'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
    7     6        BEGIN_SILENCE                                    ~8      
          7        INIT_METHOD_CALL                                         !1, 'loadXml'
          8        ROPE_INIT                                     3  ~10     '%3Ciframe_content%3E'
          9        ROPE_ADD                                      1  ~10     ~10, !0
         10        ROPE_END                                      2  ~9      ~10, '%3C%2Fiframe_content%3E'
         11        SEND_VAL_EX                                              ~9
         12        DO_FCALL                                      0          
         13        END_SILENCE                                              ~8
    8    14        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         15        SEND_VAL_EX                                              'iframe'
         16        DO_FCALL                                      0  $13     
         17        ASSIGN                                                   !2, $13
   11    18        FETCH_OBJ_R                                      ~15     !2, 'length'
         19        BOOL_NOT                                         ~16     ~15
         20      > JMPZ                                                     ~16, ->22
   12    21    >   ECHO                                                     'No+Iframe'
   16    22    >   INIT_METHOD_CALL                                         !2, 'item'
         23        SEND_VAL_EX                                              0
         24        DO_FCALL                                      0  $17     
         25        ASSIGN                                                   !3, $17
   17    26        INIT_METHOD_CALL                                         !3, 'removeAttribute'
         27        SEND_VAL_EX                                              'width'
         28        DO_FCALL                                      0          
   18    29        INIT_METHOD_CALL                                         !3, 'removeAttribute'
         30        SEND_VAL_EX                                              'height'
         31        DO_FCALL                                      0          
   20    32        INIT_METHOD_CALL                                         !1, 'saveHTML'
         33        SEND_VAR_EX                                              !3
         34        DO_FCALL                                      0  $21     
         35        ECHO                                                     $21
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.8 ms | 1395 KiB | 13 Q