3v4l.org

run code in 300+ PHP versions simultaneously
<?php function floor_dec($number,$precision = 2,$separator = '.') { $numberpart=explode($separator,$number); $numberpart[1]=substr_replace($numberpart[1],$separator,$precision,0); if($numberpart[0]>=0) { $numberpart[1]=substr(floor('1'.$numberpart[1]),1); } else { $numberpart[1]=substr(ceil('1'.$numberpart[1]),1); } $ceil_number= array($numberpart[0],$numberpart[1]); return implode($separator,$ceil_number) . "0"; } echo floor_dec(0.78, 1, ".");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EZ3Ni
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'floor_dec'
          1        SEND_VAL                                                 0.78
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 '.'
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
          6      > RETURN                                                   1

Function floor_dec:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 32
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EZ3Ni
function name:  floor_dec
number of ops:  55
compiled vars:  !0 = $number, !1 = $precision, !2 = $separator, !3 = $numberpart, !4 = $ceil_number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      2
          2        RECV_INIT                                        !2      '.'
    4     3        INIT_FCALL                                               'explode'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !3, $5
    5     8        INIT_FCALL                                               'substr_replace'
          9        FETCH_DIM_R                                      ~8      !3, 1
         10        SEND_VAL                                                 ~8
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 0
         14        DO_ICALL                                         $9      
         15        ASSIGN_DIM                                               !3, 1
         16        OP_DATA                                                  $9
    6    17        FETCH_DIM_R                                      ~10     !3, 0
         18        IS_SMALLER_OR_EQUAL                                      0, ~10
         19      > JMPZ                                                     ~11, ->32
    7    20    >   INIT_FCALL                                               'substr'
         21        INIT_FCALL                                               'floor'
         22        FETCH_DIM_R                                      ~13     !3, 1
         23        CONCAT                                           ~14     '1', ~13
         24        SEND_VAL                                                 ~14
         25        DO_ICALL                                         $15     
         26        SEND_VAR                                                 $15
         27        SEND_VAL                                                 1
         28        DO_ICALL                                         $16     
         29        ASSIGN_DIM                                               !3, 1
         30        OP_DATA                                                  $16
         31      > JMP                                                      ->43
    9    32    >   INIT_FCALL                                               'substr'
         33        INIT_FCALL                                               'ceil'
         34        FETCH_DIM_R                                      ~18     !3, 1
         35        CONCAT                                           ~19     '1', ~18
         36        SEND_VAL                                                 ~19
         37        DO_ICALL                                         $20     
         38        SEND_VAR                                                 $20
         39        SEND_VAL                                                 1
         40        DO_ICALL                                         $21     
         41        ASSIGN_DIM                                               !3, 1
         42        OP_DATA                                                  $21
   11    43    >   FETCH_DIM_R                                      ~22     !3, 0
         44        INIT_ARRAY                                       ~23     ~22
         45        FETCH_DIM_R                                      ~24     !3, 1
         46        ADD_ARRAY_ELEMENT                                ~23     ~24
         47        ASSIGN                                                   !4, ~23
   12    48        INIT_FCALL                                               'implode'
         49        SEND_VAR                                                 !2
         50        SEND_VAR                                                 !4
         51        DO_ICALL                                         $26     
         52        CONCAT                                           ~27     $26, '0'
         53      > RETURN                                                   ~27
   13    54*     > RETURN                                                   null

End of function floor_dec

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.13 ms | 1403 KiB | 26 Q