3v4l.org

run code in 300+ PHP versions simultaneously
<?php function diff($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; } diff(-1,1);//2 diff(-90,90);//180 diff(-179,179);//2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EFTvp
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'diff'
          1        SEND_VAL                                                 -1
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0          
   15     4        INIT_FCALL                                               'diff'
          5        SEND_VAL                                                 -90
          6        SEND_VAL                                                 90
          7        DO_FCALL                                      0          
   16     8        INIT_FCALL                                               'diff'
          9        SEND_VAL                                                 -179
         10        SEND_VAL                                                 179
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function diff:
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/EFTvp
function name:  diff
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, 1.5708
    6    13    >   IS_SMALLER                                               !1, 0
         14      > JMPZ                                                     ~9, ->16
         15    >   ASSIGN_OP                                     1          !1, 1.5708
    7    16    >   INIT_FCALL                                               'abs'
         17        SUB                                              ~11     !0, !1
         18        SEND_VAL                                                 ~11
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !2, $12
    9    21        INIT_FCALL                                               'min'
         22        SUB                                              ~14     1.5708, !2
         23        SEND_VAL                                                 ~14
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !2, $15
   10    27        INIT_FCALL                                               'rad2deg'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $17     
   11    30        CONCAT                                           ~18     $17, '%0A'
         31        ECHO                                                     ~18
   12    32      > RETURN                                                   null

End of function diff

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.37 ms | 1403 KiB | 24 Q