3v4l.org

run code in 300+ PHP versions simultaneously
<?php function d($t, $o){ $t = deg2rad($t); $o = deg2rad($o); if($t<0)$t += M_PI*2; if($o<0)$o += M_PI*2; $diff = abs($t-$o); $diff = min( M_PI*2 - $diff, $diff); echo rad2deg($diff) .PHP_EOL; } d(-1,1);//2 d(-90,90);//180 d(1,3); d(-179,179);//2 d(-1,-3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aBKLJ
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'd'
          1        SEND_VAL                                                 -1
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0          
   14     4        INIT_FCALL                                               'd'
          5        SEND_VAL                                                 -90
          6        SEND_VAL                                                 90
          7        DO_FCALL                                      0          
   15     8        INIT_FCALL                                               'd'
          9        SEND_VAL                                                 1
         10        SEND_VAL                                                 3
         11        DO_FCALL                                      0          
   16    12        INIT_FCALL                                               'd'
         13        SEND_VAL                                                 -179
         14        SEND_VAL                                                 179
         15        DO_FCALL                                      0          
   17    16        INIT_FCALL                                               'd'
         17        SEND_VAL                                                 -1
         18        SEND_VAL                                                 -3
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Function d:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 13
filename:       /in/aBKLJ
function name:  d
number of ops:  33
compiled vars:  !0 = $t, !1 = $o, !2 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'deg2rad'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
    4     6        INIT_FCALL                                               'deg2rad'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
    5    10        IS_SMALLER                                               !0, 0
         11      > JMPZ                                                     ~7, ->13
         12    >   ASSIGN_OP                                     1          !0, 6.28319
    6    13    >   IS_SMALLER                                               !1, 0
         14      > JMPZ                                                     ~9, ->16
         15    >   ASSIGN_OP                                     1          !1, 6.28319
    7    16    >   INIT_FCALL                                               'abs'
         17        SUB                                              ~11     !0, !1
         18        SEND_VAL                                                 ~11
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !2, $12
    8    21        INIT_FCALL                                               'min'
         22        SUB                                              ~14     6.28319, !2
         23        SEND_VAL                                                 ~14
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !2, $15
    9    27        INIT_FCALL                                               'rad2deg'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $17     
   10    30        CONCAT                                           ~18     $17, '%0A'
         31        ECHO                                                     ~18
   11    32      > RETURN                                                   null

End of function d

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.38 ms | 1407 KiB | 26 Q