3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = 1.002302000; $v = explode('.', $value); $p = 0; for ($i = 0; $i < strlen($v[1]); $i++) { if (substr($v[1], $i, 1) > 0) { $p = $i+1; } } print round($value, $p);
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/Kn4Ik
function name:  (null)
number of ops:  30
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.0023
    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                                               'round'
         25        SEND_VAR                                                 !0
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $18     
         28        ECHO                                                     $18
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.64 ms | 1396 KiB | 19 Q