3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unicodeToHtmlEntities($string) { $result = ''; $length = mb_strlen($string); for ($i = 0; $i < $length; $i++) { $result .= '&#' . chr(mb_substr($string, $i, 1)) . ';'; } return $result; } function unicodeToHtmlEntities2($string) { $result = ''; $length = strlen($string); for ($i = 0; $i < $length; $i++) { $result .= '&#' . ord(substr($string, $i, 1)) . ';'; } return $result; } echo unicodeToHtmlEntities('йцук');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/trnR8
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'unicodetohtmlentities'
          1        SEND_VAL                                                 '%D0%B9%D1%86%D1%83%D0%BA'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function unicodetohtmlentities:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 8
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 8
Branch analysis from position: 22
Branch analysis from position: 8
filename:       /in/trnR8
function name:  unicodeToHtmlEntities
number of ops:  24
compiled vars:  !0 = $string, !1 = $result, !2 = $length, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    6     2        INIT_FCALL                                               'mb_strlen'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !2, $5
    7     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->20
    8     8    >   INIT_FCALL                                               'chr'
          9        INIT_FCALL                                               'mb_substr'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !3
         12        SEND_VAL                                                 1
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                         $9      
         16        CONCAT                                           ~10     '%26%23', $9
         17        CONCAT                                           ~11     ~10, '%3B'
         18        ASSIGN_OP                                     8          !1, ~11
    7    19        PRE_INC                                                  !3
         20    >   IS_SMALLER                                               !3, !2
         21      > JMPNZ                                                    ~14, ->8
   10    22    > > RETURN                                                   !1
   11    23*     > RETURN                                                   null

End of function unicodetohtmlentities

Function unicodetohtmlentities2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 6
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 6
Branch analysis from position: 20
Branch analysis from position: 6
filename:       /in/trnR8
function name:  unicodeToHtmlEntities2
number of ops:  22
compiled vars:  !0 = $string, !1 = $result, !2 = $length, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ASSIGN                                                   !1, ''
   15     2        STRLEN                                           ~5      !0
          3        ASSIGN                                                   !2, ~5
   16     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->18
   17     6    >   INIT_FCALL                                               'ord'
          7        INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !3
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                         $9      
         14        CONCAT                                           ~10     '%26%23', $9
         15        CONCAT                                           ~11     ~10, '%3B'
         16        ASSIGN_OP                                     8          !1, ~11
   16    17        PRE_INC                                                  !3
         18    >   IS_SMALLER                                               !3, !2
         19      > JMPNZ                                                    ~14, ->6
   19    20    > > RETURN                                                   !1
   20    21*     > RETURN                                                   null

End of function unicodetohtmlentities2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.37 ms | 1407 KiB | 24 Q