3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.45 ms | 1003 KiB | 16 Q