3v4l.org

run code in 300+ PHP versions simultaneously
<?php function positionX($alpha, $r) { $x = $r * cos(deg2rad($alpha)); // X coordinates return $x; } function positionY($alpha, $r){ $y = $r * sin(deg2rad($alpha)); // Y coordinates return $y; } echo round(positionX(0, 123)) . ', ' .round(positionY(0, 123)) . "\n"; echo round(positionX(45, 123)) . ', ' .round(positionY(45, 123)) . "\n"; echo round(positionX(90, 123)) . ', ' .round(positionY(90, 123)) . "\n"; echo round(positionX(135, 123)) . ', ' .round(positionY(135, 123)) . "\n"; echo round(positionX(180, 123)) . ', ' .round(positionY(180, 123)) . "\n"; echo round(positionX(22.5, 123)) . ', ' .round(positionY(22.5, 123)) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fG1aI
function name:  (null)
number of ops:  109
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'round'
          1        INIT_FCALL                                               'positionx'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 123
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                         $1      
          7        CONCAT                                           ~2      $1, '%2C+'
          8        INIT_FCALL                                               'round'
          9        INIT_FCALL                                               'positiony'
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 123
         12        DO_FCALL                                      0  $3      
         13        SEND_VAR                                                 $3
         14        DO_ICALL                                         $4      
         15        CONCAT                                           ~5      ~2, $4
         16        CONCAT                                           ~6      ~5, '%0A'
         17        ECHO                                                     ~6
   13    18        INIT_FCALL                                               'round'
         19        INIT_FCALL                                               'positionx'
         20        SEND_VAL                                                 45
         21        SEND_VAL                                                 123
         22        DO_FCALL                                      0  $7      
         23        SEND_VAR                                                 $7
         24        DO_ICALL                                         $8      
         25        CONCAT                                           ~9      $8, '%2C+'
         26        INIT_FCALL                                               'round'
         27        INIT_FCALL                                               'positiony'
         28        SEND_VAL                                                 45
         29        SEND_VAL                                                 123
         30        DO_FCALL                                      0  $10     
         31        SEND_VAR                                                 $10
         32        DO_ICALL                                         $11     
         33        CONCAT                                           ~12     ~9, $11
         34        CONCAT                                           ~13     ~12, '%0A'
         35        ECHO                                                     ~13
   14    36        INIT_FCALL                                               'round'
         37        INIT_FCALL                                               'positionx'
         38        SEND_VAL                                                 90
         39        SEND_VAL                                                 123
         40        DO_FCALL                                      0  $14     
         41        SEND_VAR                                                 $14
         42        DO_ICALL                                         $15     
         43        CONCAT                                           ~16     $15, '%2C+'
         44        INIT_FCALL                                               'round'
         45        INIT_FCALL                                               'positiony'
         46        SEND_VAL                                                 90
         47        SEND_VAL                                                 123
         48        DO_FCALL                                      0  $17     
         49        SEND_VAR                                                 $17
         50        DO_ICALL                                         $18     
         51        CONCAT                                           ~19     ~16, $18
         52        CONCAT                                           ~20     ~19, '%0A'
         53        ECHO                                                     ~20
   15    54        INIT_FCALL                                               'round'
         55        INIT_FCALL                                               'positionx'
         56        SEND_VAL                                                 135
         57        SEND_VAL                                                 123
         58        DO_FCALL                                      0  $21     
         59        SEND_VAR                                                 $21
         60        DO_ICALL                                         $22     
         61        CONCAT                                           ~23     $22, '%2C+'
         62        INIT_FCALL                                               'round'
         63        INIT_FCALL                                               'positiony'
         64        SEND_VAL                                                 135
         65        SEND_VAL                                                 123
         66        DO_FCALL                                      0  $24     
         67        SEND_VAR                                                 $24
         68        DO_ICALL                                         $25     
         69        CONCAT                                           ~26     ~23, $25
         70        CONCAT                                           ~27     ~26, '%0A'
         71        ECHO                                                     ~27
   16    72        INIT_FCALL                                               'round'
         73        INIT_FCALL                                               'positionx'
         74        SEND_VAL                                                 180
         75        SEND_VAL                                                 123
         76        DO_FCALL                                      0  $28     
         77        SEND_VAR                                                 $28
         78        DO_ICALL                                         $29     
         79        CONCAT                                           ~30     $29, '%2C+'
         80        INIT_FCALL                                               'round'
         81        INIT_FCALL                                               'positiony'
         82        SEND_VAL                                                 180
         83        SEND_VAL                                                 123
         84        DO_FCALL                                      0  $31     
         85        SEND_VAR                                                 $31
         86        DO_ICALL                                         $32     
         87        CONCAT                                           ~33     ~30, $32
         88        CONCAT                                           ~34     ~33, '%0A'
         89        ECHO                                                     ~34
   17    90        INIT_FCALL                                               'round'
         91        INIT_FCALL                                               'positionx'
         92        SEND_VAL                                                 22.5
         93        SEND_VAL                                                 123
         94        DO_FCALL                                      0  $35     
         95        SEND_VAR                                                 $35
         96        DO_ICALL                                         $36     
         97        CONCAT                                           ~37     $36, '%2C+'
         98        INIT_FCALL                                               'round'
         99        INIT_FCALL                                               'positiony'
        100        SEND_VAL                                                 22.5
        101        SEND_VAL                                                 123
        102        DO_FCALL                                      0  $38     
        103        SEND_VAR                                                 $38
        104        DO_ICALL                                         $39     
        105        CONCAT                                           ~40     ~37, $39
        106        CONCAT                                           ~41     ~40, '%0A'
        107        ECHO                                                     ~41
        108      > RETURN                                                   1

Function positionx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fG1aI
function name:  positionX
number of ops:  12
compiled vars:  !0 = $alpha, !1 = $r, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'cos'
          3        INIT_FCALL                                               'deg2rad'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                         $4      
          8        MUL                                              ~5      !1, $4
          9        ASSIGN                                                   !2, ~5
    4    10      > RETURN                                                   !2
    5    11*     > RETURN                                                   null

End of function positionx

Function positiony:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fG1aI
function name:  positionY
number of ops:  12
compiled vars:  !0 = $alpha, !1 = $r, !2 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'sin'
          3        INIT_FCALL                                               'deg2rad'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                         $4      
          8        MUL                                              ~5      !1, $4
          9        ASSIGN                                                   !2, ~5
    9    10      > RETURN                                                   !2
   10    11*     > RETURN                                                   null

End of function positiony

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
300.93 ms | 1411 KiB | 34 Q