3v4l.org

run code in 300+ PHP versions simultaneously
<?php $derp = 0.29; function derp_round($derp, $len) { $mul = pow(10, $len); return floor($derp * $mul)/$mul; } var_dump( $derp, number_format($derp, 2), sprintf("%.2f", $derp), sprintf("%.2f", round($derp, 2, PHP_ROUND_HALF_DOWN)), sprintf("%.2f", derp_round($derp, 2)) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8eD8Y
function name:  (null)
number of ops:  34
compiled vars:  !0 = $derp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0.29
   10     1        INIT_FCALL                                               'var_dump'
   11     2        SEND_VAR                                                 !0
   12     3        INIT_FCALL                                               'number_format'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 2
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
   13     8        INIT_FCALL                                               'sprintf'
          9        SEND_VAL                                                 '%25.2f'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $3      
         12        SEND_VAR                                                 $3
   14    13        INIT_FCALL                                               'sprintf'
         14        SEND_VAL                                                 '%25.2f'
         15        INIT_FCALL                                               'round'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 2
         18        SEND_VAL                                                 2
         19        DO_ICALL                                         $4      
         20        SEND_VAR                                                 $4
         21        DO_ICALL                                         $5      
         22        SEND_VAR                                                 $5
   15    23        INIT_FCALL                                               'sprintf'
         24        SEND_VAL                                                 '%25.2f'
         25        INIT_FCALL                                               'derp_round'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 2
         28        DO_FCALL                                      0  $6      
         29        SEND_VAR                                                 $6
         30        DO_ICALL                                         $7      
         31        SEND_VAR                                                 $7
   10    32        DO_ICALL                                                 
   16    33      > RETURN                                                   1

Function derp_round:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8eD8Y
function name:  derp_round
number of ops:  14
compiled vars:  !0 = $derp, !1 = $len, !2 = $mul
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'pow'
          3        SEND_VAL                                                 10
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
    7     7        INIT_FCALL                                               'floor'
          8        MUL                                              ~5      !0, !2
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                         $6      
         11        DIV                                              ~7      $6, !2
         12      > RETURN                                                   ~7
    8    13*     > RETURN                                                   null

End of function derp_round

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.19 ms | 1023 KiB | 20 Q