3v4l.org

run code in 300+ PHP versions simultaneously
<?php function truncateHTML($html, $limit = 20) { static $wrapper = null; static $wrapperLength = 0; // trim unwanted CR/LF characters $html = trim($html); // Remove HTML comments $html = preg_replace("~<!--.*?-->~", '', $html); // If $html in in plain text if ((strlen(strip_tags($html)) > 0) && strlen(strip_tags($html)) == strlen($html)) { return substr($html, 0, $limit); } // If $html doesn't have a root element elseif (is_null($wrapper)) { if (!preg_match("~^\s*<[^\s!?]~", $html)) { // Defining a tag as our HTML wrapper $wrapper = 'div'; $htmlWrapper = "<$wrapper></$wrapper>"; $wrapperLength = strlen($htmlWrapper); $html = preg_replace("~><~", ">$html<", $htmlWrapper); } } // Calculating total length $totalLength = strlen($html); // If our input length is less than limit, we are done. if ($totalLength <= $limit) { if ($wrapper) { return preg_replace("~^<$wrapper>|</$wrapper>$~", "", $html); } return strlen(strip_tags($html)) > 0 ? $html : ''; } // Initializing a DOM object to hold our HTML $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); // Initializing a DOMXPath object to query on our DOM $xpath = new DOMXPath($dom); // Query last node (this does not include comment or text nodes) $lastNode = $xpath->query("./*[last()]")->item(0); // While manipulating, when there is no HTML element left if ($totalLength > $limit && is_null($lastNode)) { if (strlen(strip_tags($html)) >= $limit) { $textNode = $xpath->query("//text()")->item(0); if ($wrapper) { $textNode->nodeValue = substr($textNode->nodeValue, 0, $limit ); $html = $dom->saveHTML(); return preg_replace("~^<$wrapper>|</$wrapper>$~", "", $html); } else { $lengthAllowed = $limit - ($totalLength - strlen($textNode->nodeValue)); if ($lengthAllowed <= 0) { return ''; } $textNode->nodeValue = substr($textNode->nodeValue, 0, $lengthAllowed); $html = $dom->saveHTML(); return strlen(strip_tags($html)) > 0 ? $html : ''; } } else { $textNode = $xpath->query("//text()")->item(0); $textNode->nodeValue = substr($textNode->nodeValue, 0, -(($totalLength - ($wrapperLength > 0 ? $wrapperLength : 0)) - $limit)); $html = trim($dom->saveHTML()); return strlen(strip_tags($html)) > 0 ? $html : ''; } } // If we have a text node after our last HTML element elseif ($nextNode = $lastNode->nextSibling) { if ($nextNode->nodeType === 3 /* DOMText */) { $nodeLength = strlen($nextNode->nodeValue); // If by removing our text node total length will be greater than limit if (($totalLength - ($wrapperLength > 0 ? $wrapperLength : 0)) - $nodeLength >= $limit) { // We should remove it $nextNode->parentNode->removeChild($nextNode); $html = $dom->saveHTML(); return truncateHTML($html, $limit); } // If by removing our text node total length will be less than limit else { // We should truncate our text to fit the limit $nextNode->nodeValue = substr($nextNode->nodeValue, 0, ($limit - (($totalLength - ($wrapperLength > 0 ? $wrapperLength : 0)) - $nodeLength))); $html = $dom->saveHTML(); // Caring about custom wrapper if ($wrapper) { return preg_replace("~^<$wrapper>|</$wrapper>$~", "", $html); } return $html; } } } // If current node is an HTML element elseif ($lastNode->nodeType === 1 /* DOMElement */) { $nodeLength = strlen($lastNode->nodeValue); // If by removing current HTML element total length will be greater than limit if (($totalLength - ($wrapperLength > 0 ? $wrapperLength : 0)) - $nodeLength >= $limit) { // We should remove it $lastNode->parentNode->removeChild($lastNode); $html = $dom->saveHTML(); return truncateHTML($html, $limit); } // If by removing current HTML element total length will be less than limit else { // We should truncate our node value to fit the limit $lastNode->nodeValue = substr($lastNode->nodeValue, 0, ($limit - (($totalLength - ($wrapperLength > 0 ? $wrapperLength : 0)) - $nodeLength))); $html = $dom->saveHTML(); if ($wrapper) { return preg_replace("~^<$wrapper>|</$wrapper>$~", "", $html); } return $html; } } } $html = <<< HTML <div>some data sdfasdfasdfasdffrom <span class="first">blahblah test</span> was <span class="second">good</span>test<p> something</p><span class="text">hola</span><!-- comment --></div> HTML; echo truncateHTML($html, 50);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5k6Ji
function name:  (null)
number of ops:  7
compiled vars:  !0 = $html
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  118     0  E >   ASSIGN                                                   !0, '%3Cdiv%3Esome+data+sdfasdfasdfasdffrom+%3Cspan+class%3D%22first%22%3Eblahblah+test%3C%2Fspan%3E+was+%3Cspan+class%3D%22second%22%3Egood%3C%2Fspan%3Etest%3Cp%3E+something%3C%2Fp%3E%3Cspan+class%3D%22text%22%3Ehola%3C%2Fspan%3E%3C%21--+comment+--%3E%3C%2Fdiv%3E'
  122     1        INIT_FCALL                                               'truncatehtml'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 50
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function truncatehtml:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 35
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 61
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 61
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 87
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 77
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 85
Branch analysis from position: 83
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 85
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
2 jumps found. (Code = 46) Position 1 = 107, Position 2 = 109
Branch analysis from position: 107
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 217
Branch analysis from position: 110
2 jumps found. (Code = 43) Position 1 = 116, Position 2 = 177
Branch analysis from position: 116
2 jumps found. (Code = 43) Position 1 = 124, Position 2 = 147
Branch analysis from position: 124
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 147
2 jumps found. (Code = 43) Position 1 = 154, Position 2 = 155
Branch analysis from position: 154
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 155
2 jumps found. (Code = 43) Position 1 = 172, Position 2 = 174
Branch analysis from position: 172
1 jumps found. (Code = 42) Position 1 = 175
Branch analysis from position: 175
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 174
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 177
2 jumps found. (Code = 43) Position 1 = 190, Position 2 = 192
Branch analysis from position: 190
1 jumps found. (Code = 42) Position 1 = 193
Branch analysis from position: 193
2 jumps found. (Code = 43) Position 1 = 212, Position 2 = 214
Branch analysis from position: 212
1 jumps found. (Code = 42) Position 1 = 215
Branch analysis from position: 215
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 214
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 192
2 jumps found. (Code = 43) Position 1 = 212, Position 2 = 214
Branch analysis from position: 212
Branch analysis from position: 214
Branch analysis from position: 217
2 jumps found. (Code = 43) Position 1 = 220, Position 2 = 281
Branch analysis from position: 220
2 jumps found. (Code = 43) Position 1 = 223, Position 2 = 280
Branch analysis from position: 223
2 jumps found. (Code = 43) Position 1 = 228, Position 2 = 230
Branch analysis from position: 228
1 jumps found. (Code = 42) Position 1 = 231
Branch analysis from position: 231
2 jumps found. (Code = 43) Position 1 = 235, Position 2 = 248
Branch analysis from position: 235
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 248
2 jumps found. (Code = 43) Position 1 = 254, Position 2 = 256
Branch analysis from position: 254
1 jumps found. (Code = 42) Position 1 = 257
Branch analysis from position: 257
2 jumps found. (Code = 43) Position 1 = 268, Position 2 = 279
Branch analysis from position: 268
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 279
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 256
2 jumps found. (Code = 43) Position 1 = 268, Position 2 = 279
Branch analysis from position: 268
Branch analysis from position: 279
Branch analysis from position: 230
2 jumps found. (Code = 43) Position 1 = 235, Position 2 = 248
Branch analysis from position: 235
Branch analysis from position: 248
Branch analysis from position: 280
1 jumps found. (Code = 42) Position 1 = 341
Branch analysis from position: 341
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 281
2 jumps found. (Code = 43) Position 1 = 284, Position 2 = 341
Branch analysis from position: 284
2 jumps found. (Code = 43) Position 1 = 289, Position 2 = 291
Branch analysis from position: 289
1 jumps found. (Code = 42) Position 1 = 292
Branch analysis from position: 292
2 jumps found. (Code = 43) Position 1 = 296, Position 2 = 309
Branch analysis from position: 296
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 309
2 jumps found. (Code = 43) Position 1 = 315, Position 2 = 317
Branch analysis from position: 315
1 jumps found. (Code = 42) Position 1 = 318
Branch analysis from position: 318
2 jumps found. (Code = 43) Position 1 = 329, Position 2 = 340
Branch analysis from position: 329
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 340
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 317
2 jumps found. (Code = 43) Position 1 = 329, Position 2 = 340
Branch analysis from position: 329
Branch analysis from position: 340
Branch analysis from position: 291
2 jumps found. (Code = 43) Position 1 = 296, Position 2 = 309
Branch analysis from position: 296
Branch analysis from position: 309
Branch analysis from position: 341
Branch analysis from position: 109
Branch analysis from position: 61
Branch analysis from position: 61
Branch analysis from position: 27
filename:       /in/5k6Ji
function name:  truncateHTML
number of ops:  342
compiled vars:  !0 = $html, !1 = $limit, !2 = $wrapper, !3 = $wrapperLength, !4 = $htmlWrapper, !5 = $totalLength, !6 = $dom, !7 = $xpath, !8 = $lastNode, !9 = $textNode, !10 = $lengthAllowed, !11 = $nextNode, !12 = $nodeLength
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      20
    4     2        BIND_STATIC                                              !2
    5     3        BIND_STATIC                                              !3
    8     4        INIT_FCALL                                               'trim'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $13     
          7        ASSIGN                                                   !0, $13
   11     8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%7E%3C%21--.%2A%3F--%3E%7E'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $15     
         13        ASSIGN                                                   !0, $15
   14    14        INIT_FCALL                                               'strip_tags'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $17     
         17        STRLEN                                           ~18     $17
         18        IS_SMALLER                                       ~19     0, ~18
         19      > JMPZ_EX                                          ~19     ~19, ->27
         20    >   INIT_FCALL                                               'strip_tags'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $20     
         23        STRLEN                                           ~21     $20
         24        STRLEN                                           ~22     !0
         25        IS_EQUAL                                         ~23     ~21, ~22
         26        BOOL                                             ~19     ~23
         27    > > JMPZ                                                     ~19, ->35
   15    28    >   INIT_FCALL                                               'substr'
         29        SEND_VAR                                                 !0
         30        SEND_VAL                                                 0
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $24     
         33      > RETURN                                                   $24
         34*       JMP                                                      ->61
   18    35    >   TYPE_CHECK                                    2          !2
         36      > JMPZ                                                     ~25, ->61
   19    37    >   INIT_FCALL                                               'preg_match'
         38        SEND_VAL                                                 '%7E%5E%5Cs%2A%3C%5B%5E%5Cs%21%3F%5D%7E'
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                         $26     
         41        BOOL_NOT                                         ~27     $26
         42      > JMPZ                                                     ~27, ->61
   21    43    >   ASSIGN                                                   !2, 'div'
   22    44        ROPE_INIT                                     5  ~30     '%3C'
         45        ROPE_ADD                                      1  ~30     ~30, !2
         46        ROPE_ADD                                      2  ~30     ~30, '%3E%3C%2F'
         47        ROPE_ADD                                      3  ~30     ~30, !2
         48        ROPE_END                                      4  ~29     ~30, '%3E'
         49        ASSIGN                                                   !4, ~29
   23    50        STRLEN                                           ~34     !4
         51        ASSIGN                                                   !3, ~34
   24    52        INIT_FCALL                                               'preg_replace'
         53        SEND_VAL                                                 '%7E%3E%3C%7E'
         54        ROPE_INIT                                     3  ~37     '%3E'
         55        ROPE_ADD                                      1  ~37     ~37, !0
         56        ROPE_END                                      2  ~36     ~37, '%3C'
         57        SEND_VAL                                                 ~36
         58        SEND_VAR                                                 !4
         59        DO_ICALL                                         $39     
         60        ASSIGN                                                   !0, $39
   29    61    >   STRLEN                                           ~41     !0
         62        ASSIGN                                                   !5, ~41
   32    63        IS_SMALLER_OR_EQUAL                                      !5, !1
         64      > JMPZ                                                     ~43, ->87
   33    65    > > JMPZ                                                     !2, ->77
   34    66    >   INIT_FCALL                                               'preg_replace'
         67        ROPE_INIT                                     5  ~45     '%7E%5E%3C'
         68        ROPE_ADD                                      1  ~45     ~45, !2
         69        ROPE_ADD                                      2  ~45     ~45, '%3E%7C%3C%2F'
         70        ROPE_ADD                                      3  ~45     ~45, !2
         71        ROPE_END                                      4  ~44     ~45, '%3E%24%7E'
         72        SEND_VAL                                                 ~44
         73        SEND_VAL                                                 ''
         74        SEND_VAR                                                 !0
         75        DO_ICALL                                         $48     
         76      > RETURN                                                   $48
   36    77    >   INIT_FCALL                                               'strip_tags'
         78        SEND_VAR                                                 !0
         79        DO_ICALL                                         $49     
         80        STRLEN                                           ~50     $49
         81        IS_SMALLER                                               0, ~50
         82      > JMPZ                                                     ~51, ->85
         83    >   QM_ASSIGN                                        ~52     !0
         84      > JMP                                                      ->86
         85    >   QM_ASSIGN                                        ~52     ''
         86    > > RETURN                                                   ~52
   40    87    >   NEW                                              $53     'DOMDocument'
         88        DO_FCALL                                      0          
         89        ASSIGN                                                   !6, $53
   41    90        INIT_METHOD_CALL                                         !6, 'loadHTML'
         91        SEND_VAR_EX                                              !0
         92        SEND_VAL_EX                                              8196
         93        DO_FCALL                                      0          
   43    94        NEW                                              $57     'DOMXPath'
         95        SEND_VAR_EX                                              !6
         96        DO_FCALL                                      0          
         97        ASSIGN                                                   !7, $57
   45    98        INIT_METHOD_CALL                                         !7, 'query'
         99        SEND_VAL_EX                                              '.%2F%2A%5Blast%28%29%5D'
        100        DO_FCALL                                      0  $60     
        101        INIT_METHOD_CALL                                         $60, 'item'
        102        SEND_VAL_EX                                              0
        103        DO_FCALL                                      0  $61     
        104        ASSIGN                                                   !8, $61
   48   105        IS_SMALLER                                       ~63     !1, !5
        106      > JMPZ_EX                                          ~63     ~63, ->109
        107    >   TYPE_CHECK                                    2  ~64     !8
        108        BOOL                                             ~63     ~64
        109    > > JMPZ                                                     ~63, ->217
   49   110    >   INIT_FCALL                                               'strip_tags'
        111        SEND_VAR                                                 !0
        112        DO_ICALL                                         $65     
        113        STRLEN                                           ~66     $65
        114        IS_SMALLER_OR_EQUAL                                      !1, ~66
        115      > JMPZ                                                     ~67, ->177
   50   116    >   INIT_METHOD_CALL                                         !7, 'query'
        117        SEND_VAL_EX                                              '%2F%2Ftext%28%29'
        118        DO_FCALL                                      0  $68     
        119        INIT_METHOD_CALL                                         $68, 'item'
        120        SEND_VAL_EX                                              0
        121        DO_FCALL                                      0  $69     
        122        ASSIGN                                                   !9, $69
   51   123      > JMPZ                                                     !2, ->147
   52   124    >   INIT_FCALL                                               'substr'
        125        FETCH_OBJ_R                                      ~72     !9, 'nodeValue'
        126        SEND_VAL                                                 ~72
        127        SEND_VAL                                                 0
        128        SEND_VAR                                                 !1
        129        DO_ICALL                                         $73     
        130        ASSIGN_OBJ                                               !9, 'nodeValue'
        131        OP_DATA                                                  $73
   53   132        INIT_METHOD_CALL                                         !6, 'saveHTML'
        133        DO_FCALL                                      0  $74     
        134        ASSIGN                                                   !0, $74
   54   135        INIT_FCALL                                               'preg_replace'
        136        ROPE_INIT                                     5  ~77     '%7E%5E%3C'
        137        ROPE_ADD                                      1  ~77     ~77, !2
        138        ROPE_ADD                                      2  ~77     ~77, '%3E%7C%3C%2F'
        139        ROPE_ADD                                      3  ~77     ~77, !2
        140        ROPE_END                                      4  ~76     ~77, '%3E%24%7E'
        141        SEND_VAL                                                 ~76
        142        SEND_VAL                                                 ''
        143        SEND_VAR                                                 !0
        144        DO_ICALL                                         $80     
        145      > RETURN                                                   $80
        146*       JMP                                                      ->176
   56   147    >   FETCH_OBJ_R                                      ~81     !9, 'nodeValue'
        148        STRLEN                                           ~82     ~81
        149        SUB                                              ~83     !5, ~82
        150        SUB                                              ~84     !1, ~83
        151        ASSIGN                                                   !10, ~84
   57   152        IS_SMALLER_OR_EQUAL                                      !10, 0
        153      > JMPZ                                                     ~86, ->155
   58   154    > > RETURN                                                   ''
   60   155    >   INIT_FCALL                                               'substr'
        156        FETCH_OBJ_R                                      ~88     !9, 'nodeValue'
        157        SEND_VAL                                                 ~88
        158        SEND_VAL                                                 0
        159        SEND_VAR                                                 !10
        160        DO_ICALL                                         $89     
        161        ASSIGN_OBJ                                               !9, 'nodeValue'
        162        OP_DATA                                                  $89
   61   163        INIT_METHOD_CALL                                         !6, 'saveHTML'
        164        DO_FCALL                                      0  $90     
        165        ASSIGN                                                   !0, $90
   62   166        INIT_FCALL                                               'strip_tags'
        167        SEND_VAR                                                 !0
        168        DO_ICALL                                         $92     
        169        STRLEN                                           ~93     $92
        170        IS_SMALLER                                               0, ~93
        171      > JMPZ                                                     ~94, ->174
        172    >   QM_ASSIGN                                        ~95     !0
        173      > JMP                                                      ->175
        174    >   QM_ASSIGN                                        ~95     ''
        175    > > RETURN                                                   ~95
        176*       JMP                                                      ->216
   65   177    >   INIT_METHOD_CALL                                         !7, 'query'
        178        SEND_VAL_EX                                              '%2F%2Ftext%28%29'
        179        DO_FCALL                                      0  $96     
        180        INIT_METHOD_CALL                                         $96, 'item'
        181        SEND_VAL_EX                                              0
        182        DO_FCALL                                      0  $97     
        183        ASSIGN                                                   !9, $97
   66   184        INIT_FCALL                                               'substr'
        185        FETCH_OBJ_R                                      ~100    !9, 'nodeValue'
        186        SEND_VAL                                                 ~100
        187        SEND_VAL                                                 0
        188        IS_SMALLER                                               0, !3
        189      > JMPZ                                                     ~101, ->192
        190    >   QM_ASSIGN                                        ~102    !3
        191      > JMP                                                      ->193
        192    >   QM_ASSIGN                                        ~102    0
        193    >   SUB                                              ~103    !5, ~102
        194        SUB                                              ~104    ~103, !1
        195        MUL                                              ~105    ~104, -1
        196        SEND_VAL                                                 ~105
        197        DO_ICALL                                         $106    
        198        ASSIGN_OBJ                                               !9, 'nodeValue'
        199        OP_DATA                                                  $106
   67   200        INIT_FCALL                                               'trim'
        201        INIT_METHOD_CALL                                         !6, 'saveHTML'
        202        DO_FCALL                                      0  $107    
        203        SEND_VAR                                                 $107
        204        DO_ICALL                                         $108    
        205        ASSIGN                                                   !0, $108
   68   206        INIT_FCALL                                               'strip_tags'
        207        SEND_VAR                                                 !0
        208        DO_ICALL                                         $110    
        209        STRLEN                                           ~111    $110
        210        IS_SMALLER                                               0, ~111
        211      > JMPZ                                                     ~112, ->214
        212    >   QM_ASSIGN                                        ~113    !0
        213      > JMP                                                      ->215
        214    >   QM_ASSIGN                                        ~113    ''
        215    > > RETURN                                                   ~113
        216*       JMP                                                      ->341
   72   217    >   FETCH_OBJ_R                                      ~114    !8, 'nextSibling'
        218        ASSIGN                                           ~115    !11, ~114
        219      > JMPZ                                                     ~115, ->281
   73   220    >   FETCH_OBJ_R                                      ~116    !11, 'nodeType'
        221        IS_IDENTICAL                                             ~116, 3
        222      > JMPZ                                                     ~117, ->280
   74   223    >   FETCH_OBJ_R                                      ~118    !11, 'nodeValue'
        224        STRLEN                                           ~119    ~118
        225        ASSIGN                                                   !12, ~119
   76   226        IS_SMALLER                                               0, !3
        227      > JMPZ                                                     ~121, ->230
        228    >   QM_ASSIGN                                        ~122    !3
        229      > JMP                                                      ->231
        230    >   QM_ASSIGN                                        ~122    0
        231    >   SUB                                              ~123    !5, ~122
        232        SUB                                              ~124    ~123, !12
        233        IS_SMALLER_OR_EQUAL                                      !1, ~124
        234      > JMPZ                                                     ~125, ->248
   78   235    >   FETCH_OBJ_R                                      ~126    !11, 'parentNode'
        236        INIT_METHOD_CALL                                         ~126, 'removeChild'
        237        SEND_VAR_EX                                              !11
        238        DO_FCALL                                      0          
   79   239        INIT_METHOD_CALL                                         !6, 'saveHTML'
        240        DO_FCALL                                      0  $128    
        241        ASSIGN                                                   !0, $128
   80   242        INIT_FCALL_BY_NAME                                       'truncateHTML'
        243        SEND_VAR_EX                                              !0
        244        SEND_VAR_EX                                              !1
        245        DO_FCALL                                      0  $130    
        246      > RETURN                                                   $130
        247*       JMP                                                      ->280
   85   248    >   INIT_FCALL                                               'substr'
        249        FETCH_OBJ_R                                      ~132    !11, 'nodeValue'
        250        SEND_VAL                                                 ~132
        251        SEND_VAL                                                 0
        252        IS_SMALLER                                               0, !3
        253      > JMPZ                                                     ~133, ->256
        254    >   QM_ASSIGN                                        ~134    !3
        255      > JMP                                                      ->257
        256    >   QM_ASSIGN                                        ~134    0
        257    >   SUB                                              ~135    !5, ~134
        258        SUB                                              ~136    ~135, !12
        259        SUB                                              ~137    !1, ~136
        260        SEND_VAL                                                 ~137
        261        DO_ICALL                                         $138    
        262        ASSIGN_OBJ                                               !11, 'nodeValue'
        263        OP_DATA                                                  $138
   86   264        INIT_METHOD_CALL                                         !6, 'saveHTML'
        265        DO_FCALL                                      0  $139    
        266        ASSIGN                                                   !0, $139
   88   267      > JMPZ                                                     !2, ->279
   89   268    >   INIT_FCALL                                               'preg_replace'
        269        ROPE_INIT                                     5  ~142    '%7E%5E%3C'
        270        ROPE_ADD                                      1  ~142    ~142, !2
        271        ROPE_ADD                                      2  ~142    ~142, '%3E%7C%3C%2F'
        272        ROPE_ADD                                      3  ~142    ~142, !2
        273        ROPE_END                                      4  ~141    ~142, '%3E%24%7E'
        274        SEND_VAL                                                 ~141
        275        SEND_VAL                                                 ''
        276        SEND_VAR                                                 !0
        277        DO_ICALL                                         $145    
        278      > RETURN                                                   $145
   91   279    > > RETURN                                                   !0
        280    > > JMP                                                      ->341
   96   281    >   FETCH_OBJ_R                                      ~146    !8, 'nodeType'
        282        IS_IDENTICAL                                             ~146, 1
        283      > JMPZ                                                     ~147, ->341
   97   284    >   FETCH_OBJ_R                                      ~148    !8, 'nodeValue'
        285        STRLEN                                           ~149    ~148
        286        ASSIGN                                                   !12, ~149
   99   287        IS_SMALLER                                               0, !3
        288      > JMPZ                                                     ~151, ->291
        289    >   QM_ASSIGN                                        ~152    !3
        290      > JMP                                                      ->292
        291    >   QM_ASSIGN                                        ~152    0
        292    >   SUB                                              ~153    !5, ~152
        293        SUB                                              ~154    ~153, !12
        294        IS_SMALLER_OR_EQUAL                                      !1, ~154
        295      > JMPZ                                                     ~155, ->309
  101   296    >   FETCH_OBJ_R                                      ~156    !8, 'parentNode'
        297        INIT_METHOD_CALL                                         ~156, 'removeChild'
        298        SEND_VAR_EX                                              !8
        299        DO_FCALL                                      0          
  102   300        INIT_METHOD_CALL                                         !6, 'saveHTML'
        301        DO_FCALL                                      0  $158    
        302        ASSIGN                                                   !0, $158
  103   303        INIT_FCALL_BY_NAME                                       'truncateHTML'
        304        SEND_VAR_EX                                              !0
        305        SEND_VAR_EX          

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.46 ms | 1431 KiB | 24 Q