3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = "1.098324000234000"; $v = explode('.', $value); $p = 0; for ($i = 0; $i < strlen($v[1]); $i++) { if (substr($v[1], $i, 1) > 0) { $p = $i+1; } } var_dump(round($value, $p)); var_dump((float) ($value));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 9
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 9
Branch analysis from position: 24
Branch analysis from position: 9
Branch analysis from position: 19
filename:       /in/11pdA
function name:  (null)
number of ops:  36
compiled vars:  !0 = $value, !1 = $v, !2 = $p, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1.098324000234000'
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    4     6        ASSIGN                                                   !2, 0
    5     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->20
    6     9    >   INIT_FCALL                                               'substr'
         10        FETCH_DIM_R                                      ~9      !1, 1
         11        SEND_VAL                                                 ~9
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $10     
         15        IS_SMALLER                                               0, $10
         16      > JMPZ                                                     ~11, ->19
    7    17    >   ADD                                              ~12     !3, 1
         18        ASSIGN                                                   !2, ~12
    5    19    >   PRE_INC                                                  !3
         20    >   FETCH_DIM_R                                      ~15     !1, 1
         21        STRLEN                                           ~16     ~15
         22        IS_SMALLER                                               !3, ~16
         23      > JMPNZ                                                    ~17, ->9
   10    24    >   INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'round'
         26        SEND_VAR                                                 !0
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $18     
         29        SEND_VAR                                                 $18
         30        DO_ICALL                                                 
   11    31        INIT_FCALL                                               'var_dump'
         32        CAST                                          5  ~20     !0
         33        SEND_VAL                                                 ~20
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.11 ms | 1396 KiB | 21 Q