3v4l.org

run code in 300+ PHP versions simultaneously
<?php function paddit ($num) { $padding = strlen($num) - 1; $firstDigit = $num[0]; return str_pad($firstDigit, $padding, '0'); } echo paddit(392);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iWfkZ
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'paddit'
          1        SEND_VAL                                                 392
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function paddit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iWfkZ
function name:  paddit
number of ops:  13
compiled vars:  !0 = $num, !1 = $padding, !2 = $firstDigit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        STRLEN                                           ~3      !0
          2        SUB                                              ~4      ~3, 1
          3        ASSIGN                                                   !1, ~4
    5     4        FETCH_DIM_R                                      ~6      !0, 0
          5        ASSIGN                                                   !2, ~6
    6     6        INIT_FCALL                                               'str_pad'
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 '0'
         10        DO_ICALL                                         $8      
         11      > RETURN                                                   $8
    7    12*     > RETURN                                                   null

End of function paddit

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.63 ms | 1397 KiB | 16 Q