3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testValue = str_repeat('A', 100000); function testXML($enc, $val) { $xml = new DomDocument('1.0', $enc); $xml->appendChild($xml->createElement('foo', $val)); $xml = $xml->saveXML(); $xml2 = new DomDocument('1.0', $enc); $xml2->loadXML($xml); return strlen($xml2->firstChild->nodeValue); } function d($enc, $size) { echo sprintf("%25s -> %s\n", $enc, $size); } d('Original size', strlen($testValue)); d('BIG-5', testXML('BIG-5', $testValue)); d('SHIFT-JIS', testXML('SHIFT-JIS', $testValue)); d('SHIFT_JIS', testXML('SHIFT_JIS', $testValue)); d('Shift_JIS', testXML('Shift_JIS', $testValue)); d('UTF-8', testXML('UTF-8', $testValue)); d('ASCII', testXML('ASCII', $testValue)); d('ISO-8859-1', testXML('ISO-8859-1', $testValue));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d1SZQ
function name:  (null)
number of ops:  67
compiled vars:  !0 = $testValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'str_repeat'
          1        SEND_VAL                                                 'A'
          2        SEND_VAL                                                 100000
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   19     5        INIT_FCALL                                               'd'
          6        SEND_VAL                                                 'Original+size'
          7        STRLEN                                           ~3      !0
          8        SEND_VAL                                                 ~3
          9        DO_FCALL                                      0          
   21    10        INIT_FCALL                                               'd'
         11        SEND_VAL                                                 'BIG-5'
         12        INIT_FCALL                                               'testxml'
         13        SEND_VAL                                                 'BIG-5'
         14        SEND_VAR                                                 !0
         15        DO_FCALL                                      0  $5      
         16        SEND_VAR                                                 $5
         17        DO_FCALL                                      0          
   22    18        INIT_FCALL                                               'd'
         19        SEND_VAL                                                 'SHIFT-JIS'
         20        INIT_FCALL                                               'testxml'
         21        SEND_VAL                                                 'SHIFT-JIS'
         22        SEND_VAR                                                 !0
         23        DO_FCALL                                      0  $7      
         24        SEND_VAR                                                 $7
         25        DO_FCALL                                      0          
   23    26        INIT_FCALL                                               'd'
         27        SEND_VAL                                                 'SHIFT_JIS'
         28        INIT_FCALL                                               'testxml'
         29        SEND_VAL                                                 'SHIFT_JIS'
         30        SEND_VAR                                                 !0
         31        DO_FCALL                                      0  $9      
         32        SEND_VAR                                                 $9
         33        DO_FCALL                                      0          
   24    34        INIT_FCALL                                               'd'
         35        SEND_VAL                                                 'Shift_JIS'
         36        INIT_FCALL                                               'testxml'
         37        SEND_VAL                                                 'Shift_JIS'
         38        SEND_VAR                                                 !0
         39        DO_FCALL                                      0  $11     
         40        SEND_VAR                                                 $11
         41        DO_FCALL                                      0          
   25    42        INIT_FCALL                                               'd'
         43        SEND_VAL                                                 'UTF-8'
         44        INIT_FCALL                                               'testxml'
         45        SEND_VAL                                                 'UTF-8'
         46        SEND_VAR                                                 !0
         47        DO_FCALL                                      0  $13     
         48        SEND_VAR                                                 $13
         49        DO_FCALL                                      0          
   26    50        INIT_FCALL                                               'd'
         51        SEND_VAL                                                 'ASCII'
         52        INIT_FCALL                                               'testxml'
         53        SEND_VAL                                                 'ASCII'
         54        SEND_VAR                                                 !0
         55        DO_FCALL                                      0  $15     
         56        SEND_VAR                                                 $15
         57        DO_FCALL                                      0          
   27    58        INIT_FCALL                                               'd'
         59        SEND_VAL                                                 'ISO-8859-1'
         60        INIT_FCALL                                               'testxml'
         61        SEND_VAL                                                 'ISO-8859-1'
         62        SEND_VAR                                                 !0
         63        DO_FCALL                                      0  $17     
         64        SEND_VAR                                                 $17
         65        DO_FCALL                                      0          
         66      > RETURN                                                   1

Function testxml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d1SZQ
function name:  testXML
number of ops:  30
compiled vars:  !0 = $enc, !1 = $val, !2 = $xml, !3 = $xml2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        NEW                                              $4      'DomDocument'
          3        SEND_VAL_EX                                              '1.0'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $4
    7     7        INIT_METHOD_CALL                                         !2, 'appendChild'
          8        INIT_METHOD_CALL                                         !2, 'createElement'
          9        SEND_VAL_EX                                              'foo'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0  $7      
         12        SEND_VAR_NO_REF_EX                                       $7
         13        DO_FCALL                                      0          
    8    14        INIT_METHOD_CALL                                         !2, 'saveXML'
         15        DO_FCALL                                      0  $9      
         16        ASSIGN                                                   !2, $9
   10    17        NEW                                              $11     'DomDocument'
         18        SEND_VAL_EX                                              '1.0'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !3, $11
   11    22        INIT_METHOD_CALL                                         !3, 'loadXML'
         23        SEND_VAR_EX                                              !2
         24        DO_FCALL                                      0          
   12    25        FETCH_OBJ_R                                      ~15     !3, 'firstChild'
         26        FETCH_OBJ_R                                      ~16     ~15, 'nodeValue'
         27        STRLEN                                           ~17     ~16
         28      > RETURN                                                   ~17
   13    29*     > RETURN                                                   null

End of function testxml

Function d:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d1SZQ
function name:  d
number of ops:  9
compiled vars:  !0 = $enc, !1 = $size
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        INIT_FCALL                                               'sprintf'
          3        SEND_VAL                                                 '%2525s+-%3E+%25s%0A'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        ECHO                                                     $2
   17     8      > RETURN                                                   null

End of function d

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.71 ms | 1407 KiB | 32 Q