3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formatDataLenght($data, $length, $string = ' ', $place = STR_PAD_RIGHT) { mb_internal_encoding("utf-8"); // IMPORTANT : Hack for UTF-8 str_pad function $_result = $data; if (mb_strlen($data) < $length) { $_result = $this->strPadUnicode((string)$_result, $length, $string, $place); if (mb_strlen($_result) != $length && $string != '') { $_result = str_pad((string)$_result, $length, $string, $place); } } if (mb_strlen($data) > $length) { $_result = mb_substr($data, 0, $length); } return $_result; } echo formatDataLenght("aze",8,0); echo formatDataLenght("aze",8,0,STR_PAD_LEFT);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jAYYs
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'formatdatalenght'
          1        SEND_VAL                                                 'aze'
          2        SEND_VAL                                                 8
          3        SEND_VAL                                                 0
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
   21     6        INIT_FCALL                                               'formatdatalenght'
          7        SEND_VAL                                                 'aze'
          8        SEND_VAL                                                 8
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 0
         11        DO_FCALL                                      0  $1      
         12        ECHO                                                     $1
         13      > RETURN                                                   1

Function formatdatalenght:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 38
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 38
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 49
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 38
Branch analysis from position: 29
Branch analysis from position: 38
filename:       /in/jAYYs
function name:  formatDataLenght
number of ops:  51
compiled vars:  !0 = $data, !1 = $length, !2 = $string, !3 = $place, !4 = $_result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      '+'
          3        RECV_INIT                                        !3      <const ast>
    5     4        INIT_FCALL                                               'mb_internal_encoding'
          5        SEND_VAL                                                 'utf-8'
          6        DO_ICALL                                                 
    7     7        ASSIGN                                                   !4, !0
    8     8        INIT_FCALL                                               'mb_strlen'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        IS_SMALLER                                               $7, !1
         12      > JMPZ                                                     ~8, ->38
    9    13    >   FETCH_THIS                                       $9      
         14        INIT_METHOD_CALL                                         $9, 'strPadUnicode'
         15        CAST                                          6  ~10     !4
         16        SEND_VAL_EX                                              ~10
         17        SEND_VAR_EX                                              !1
         18        SEND_VAR_EX                                              !2
         19        SEND_VAR_EX                                              !3
         20        DO_FCALL                                      0  $11     
         21        ASSIGN                                                   !4, $11
   10    22        INIT_FCALL                                               'mb_strlen'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                         $13     
         25        IS_NOT_EQUAL                                     ~14     !1, $13
         26      > JMPZ_EX                                          ~14     ~14, ->29
         27    >   IS_NOT_EQUAL                                     ~15     !2, ''
         28        BOOL                                             ~14     ~15
         29    > > JMPZ                                                     ~14, ->38
   11    30    >   INIT_FCALL                                               'str_pad'
         31        CAST                                          6  ~16     !4
         32        SEND_VAL                                                 ~16
         33        SEND_VAR                                                 !1
         34        SEND_VAR                                                 !2
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $17     
         37        ASSIGN                                                   !4, $17
   14    38    >   INIT_FCALL                                               'mb_strlen'
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                         $19     
         41        IS_SMALLER                                               !1, $19
         42      > JMPZ                                                     ~20, ->49
   15    43    >   INIT_FCALL                                               'mb_substr'
         44        SEND_VAR                                                 !0
         45        SEND_VAL                                                 0
         46        SEND_VAR                                                 !1
         47        DO_ICALL                                         $21     
         48        ASSIGN                                                   !4, $21
   18    49    > > RETURN                                                   !4
   19    50*     > RETURN                                                   null

End of function formatdatalenght

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.44 ms | 1403 KiB | 23 Q