3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cena = 175210; $pogp = 50; function my_round($arg, $base){ $ost = $arg%$base; $chast = floor($arg/$base); if($ost >= $base/2) $rez = ($chast+1) * $base; else $rez = $chast * $base; return $rez; } echo "cena $cena pogp $pogp " . my_round($cena, $pogp); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fHNTa
function name:  (null)
number of ops:  14
compiled vars:  !0 = $cena, !1 = $pogp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 175210
    4     1        ASSIGN                                                   !1, 50
   13     2        ROPE_INIT                                     5  ~5      'cena+'
          3        ROPE_ADD                                      1  ~5      ~5, !0
          4        ROPE_ADD                                      2  ~5      ~5, '+pogp+'
          5        ROPE_ADD                                      3  ~5      ~5, !1
          6        ROPE_END                                      4  ~4      ~5, '+'
          7        INIT_FCALL                                               'my_round'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0  $8      
         11        CONCAT                                           ~9      ~4, $8
         12        ECHO                                                     ~9
   14    13      > RETURN                                                   1

Function my_round:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fHNTa
function name:  my_round
number of ops:  20
compiled vars:  !0 = $arg, !1 = $base, !2 = $ost, !3 = $chast, !4 = $rez
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        MOD                                              ~5      !0, !1
          3        ASSIGN                                                   !2, ~5
    8     4        INIT_FCALL                                               'floor'
          5        DIV                                              ~7      !0, !1
          6        SEND_VAL                                                 ~7
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !3, $8
    9     9        DIV                                              ~10     !1, 2
         10        IS_SMALLER_OR_EQUAL                                      ~10, !2
         11      > JMPZ                                                     ~11, ->16
         12    >   ADD                                              ~12     !3, 1
         13        MUL                                              ~13     !1, ~12
         14        ASSIGN                                                   !4, ~13
         15      > JMP                                                      ->18
   10    16    >   MUL                                              ~15     !3, !1
         17        ASSIGN                                                   !4, ~15
   11    18    > > RETURN                                                   !4
   12    19*     > RETURN                                                   null

End of function my_round

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.23 ms | 1399 KiB | 16 Q