3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getPatientCodeDisplay($id='') { if(intval($id)>0) { $id_length = strlen($id); $prefix_code = "AHD"; $final_len = 6+strlen($prefix_code)-$id_length; $retstr = str_pad($prefix_code, $final_len, "0", STR_PAD_RIGHT); $retstr .= $id; } else { $retstr = ""; } return $retstr; } echo getPatientCodeDisplay();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/THGqb
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'getpatientcodedisplay'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function getpatientcodedisplay:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/THGqb
function name:  getPatientCodeDisplay
number of ops:  23
compiled vars:  !0 = $id, !1 = $id_length, !2 = $prefix_code, !3 = $final_len, !4 = $retstr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      ''
    3     1        CAST                                          4  ~5      !0
          2        IS_SMALLER                                               0, ~5
          3      > JMPZ                                                     ~6, ->20
    4     4    >   STRLEN                                           ~7      !0
          5        ASSIGN                                                   !1, ~7
    5     6        ASSIGN                                                   !2, 'AHD'
    6     7        STRLEN                                           ~10     !2
          8        ADD                                              ~11     6, ~10
          9        SUB                                              ~12     ~11, !1
         10        ASSIGN                                                   !3, ~12
    7    11        INIT_FCALL                                               'str_pad'
         12        SEND_VAR                                                 !2
         13        SEND_VAR                                                 !3
         14        SEND_VAL                                                 '0'
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $14     
         17        ASSIGN                                                   !4, $14
    8    18        ASSIGN_OP                                     8          !4, !0
         19      > JMP                                                      ->21
   10    20    >   ASSIGN                                                   !4, ''
   13    21    > > RETURN                                                   !4
   14    22*     > RETURN                                                   null

End of function getpatientcodedisplay

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.31 ms | 1390 KiB | 16 Q