3v4l.org

run code in 300+ PHP versions simultaneously
<?php // n-dashes are encoded as byte sequence \xe2\x80\x93 in UTF-8 $str = 'foo–bar–baz'; // take substring of 4 bytes length starting with the 4th byte var_dump(mb_strcut($str, 4, 4, 'UTF-8')); // take substring of 4 code points length starting with the 4th code point var_dump(mb_substr($str, 4, 4, 'UTF-8'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1pUss
function name:  (null)
number of ops:  20
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'foo%E2%80%93bar%E2%80%93baz'
    6     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'mb_strcut'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 4
          5        SEND_VAL                                                 4
          6        SEND_VAL                                                 'UTF-8'
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
    8    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'mb_substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 4
         14        SEND_VAL                                                 4
         15        SEND_VAL                                                 'UTF-8'
         16        DO_ICALL                                         $4      
         17        SEND_VAR                                                 $4
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.09 ms | 1394 KiB | 19 Q