3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'Dunakanyari és Pilisi Önkormányzatok Többcélú Kistérségi Társulása'; function limitTextLength($text, $limit = 20) { if(strlen($text) > $limit) { $res = mb_substr($text, 0, $limit)."..."; } else { $res = $text; } return $res; } print limitTextLength($str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pdm0I
function name:  (null)
number of ops:  6
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Dunakanyari+%C3%A9s+Pilisi+%C3%96nkorm%C3%A1nyzatok+T%C3%B6bbc%C3%A9l%C3%BA+Kist%C3%A9rs%C3%A9gi+T%C3%A1rsul%C3%A1sa'
   13     1        INIT_FCALL                                               'limittextlength'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function limittextlength:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pdm0I
function name:  limitTextLength
number of ops:  16
compiled vars:  !0 = $text, !1 = $limit, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      20
    5     2        STRLEN                                           ~3      !0
          3        IS_SMALLER                                               !1, ~3
          4      > JMPZ                                                     ~4, ->13
    6     5    >   INIT_FCALL                                               'mb_substr'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 0
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        CONCAT                                           ~6      $5, '...'
         11        ASSIGN                                                   !2, ~6
         12      > JMP                                                      ->14
    8    13    >   ASSIGN                                                   !2, !0
   10    14    > > RETURN                                                   !2
   11    15*     > RETURN                                                   null

End of function limittextlength

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.71 ms | 1398 KiB | 16 Q