3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(strlen(iconv('utf-8', 'utf-16le', 'A B C')) / 2); # correct var_dump(strlen(iconv('utf-8', 'utf-16le', '🎖')) / 2); # correct var_dump(strlen(mb_convert_encoding('A B C', 'UTF-32BE', 'UTF-8')) / 2); # off by 5 chars var_dump(strlen(mb_convert_encoding('🎖', 'UTF-32BE', 'UTF-8')) / 2); # correct var_dump(mb_strlen(mb_convert_encoding('A B C', 'UTF-32BE', 'UTF-8')) / 2); # off by 5 chars var_dump(mb_strlen(mb_convert_encoding('🎖', 'UTF-32BE', 'UTF-8')) / 2); # correct
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kTNkF
function name:  (null)
number of ops:  65
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL_BY_NAME                                       'iconv'
          2        SEND_VAL_EX                                              'utf-8'
          3        SEND_VAL_EX                                              'utf-16le'
          4        SEND_VAL_EX                                              'A+B+C'
          5        DO_FCALL                                      0  $0      
          6        STRLEN                                           ~1      $0
          7        DIV                                              ~2      ~1, 2
          8        SEND_VAL                                                 ~2
          9        DO_ICALL                                                 
    5    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL_BY_NAME                                       'iconv'
         12        SEND_VAL_EX                                              'utf-8'
         13        SEND_VAL_EX                                              'utf-16le'
         14        SEND_VAL_EX                                              '%F0%9F%8E%96'
         15        DO_FCALL                                      0  $4      
         16        STRLEN                                           ~5      $4
         17        DIV                                              ~6      ~5, 2
         18        SEND_VAL                                                 ~6
         19        DO_ICALL                                                 
    9    20        INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'mb_convert_encoding'
         22        SEND_VAL                                                 'A+B+C'
         23        SEND_VAL                                                 'UTF-32BE'
         24        SEND_VAL                                                 'UTF-8'
         25        DO_ICALL                                         $8      
         26        STRLEN                                           ~9      $8
         27        DIV                                              ~10     ~9, 2
         28        SEND_VAL                                                 ~10
         29        DO_ICALL                                                 
   10    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'mb_convert_encoding'
         32        SEND_VAL                                                 '%F0%9F%8E%96'
         33        SEND_VAL                                                 'UTF-32BE'
         34        SEND_VAL                                                 'UTF-8'
         35        DO_ICALL                                         $12     
         36        STRLEN                                           ~13     $12
         37        DIV                                              ~14     ~13, 2
         38        SEND_VAL                                                 ~14
         39        DO_ICALL                                                 
   14    40        INIT_FCALL                                               'var_dump'
         41        INIT_FCALL                                               'mb_strlen'
         42        INIT_FCALL                                               'mb_convert_encoding'
         43        SEND_VAL                                                 'A+B+C'
         44        SEND_VAL                                                 'UTF-32BE'
         45        SEND_VAL                                                 'UTF-8'
         46        DO_ICALL                                         $16     
         47        SEND_VAR                                                 $16
         48        DO_ICALL                                         $17     
         49        DIV                                              ~18     $17, 2
         50        SEND_VAL                                                 ~18
         51        DO_ICALL                                                 
   15    52        INIT_FCALL                                               'var_dump'
         53        INIT_FCALL                                               'mb_strlen'
         54        INIT_FCALL                                               'mb_convert_encoding'
         55        SEND_VAL                                                 '%F0%9F%8E%96'
         56        SEND_VAL                                                 'UTF-32BE'
         57        SEND_VAL                                                 'UTF-8'
         58        DO_ICALL                                         $20     
         59        SEND_VAR                                                 $20
         60        DO_ICALL                                         $21     
         61        DIV                                              ~22     $21, 2
         62        SEND_VAL                                                 ~22
         63        DO_ICALL                                                 
         64      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.76 ms | 945 KiB | 20 Q