3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Point { public $X; public $Y; function __construct($X, $Y) { $this->X = $X; $this->Y = $Y; } } $moves = 10; $mouseX = 200; $mouseY = 200; $point = new Point(300, 300); $startAngle = rand(0, 90); $angles = array($startAngle); for ( $i=1; $i<$moves; $i++ ) { $angles[$i] = $angles[$i-1] + (90 - 2*$startAngle)/($moves-1); } $lineHeightDiv = 0; foreach ( $angles as $angle ) { $lineHeightDiv += sin($angle*pi()/180); } $lineHeight = ($point->Y-$mouseY)/$moves; $lineWidthDiv = 0; foreach ( $angles as $angle ) { $lineWidthDiv += cos($angle*pi()/180); } $lineWidth = ($point->X - $mouseX)/$moves; $points = array(new Point($mouseX, $mouseY)); for ( $i=1; $i<=$moves; $i++ ) { $x = $points[$i-1]->X + $lineWidth; $y = $points[$i-1]->Y + $lineHeight; $points[] = new Point($x, $y); } var_dump($points);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 17
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 41
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 41
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 41
2 jumps found. (Code = 77) Position 1 = 48, Position 2 = 58
Branch analysis from position: 48
2 jumps found. (Code = 78) Position 1 = 49, Position 2 = 58
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
2 jumps found. (Code = 44) Position 1 = 90, Position 2 = 71
Branch analysis from position: 90
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 90, Position 2 = 71
Branch analysis from position: 90
Branch analysis from position: 71
Branch analysis from position: 58
Branch analysis from position: 41
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 17
Branch analysis from position: 29
Branch analysis from position: 17
filename:       /in/SLYWr
function name:  (null)
number of ops:  94
compiled vars:  !0 = $moves, !1 = $mouseX, !2 = $mouseY, !3 = $point, !4 = $startAngle, !5 = $angles, !6 = $i, !7 = $lineHeightDiv, !8 = $angle, !9 = $lineHeight, !10 = $lineWidthDiv, !11 = $lineWidth, !12 = $points, !13 = $x, !14 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 10
   14     1        ASSIGN                                                   !1, 200
   15     2        ASSIGN                                                   !2, 200
   16     3        NEW                                              $18     'Point'
          4        SEND_VAL_EX                                              300
          5        SEND_VAL_EX                                              300
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !3, $18
   19     8        INIT_FCALL                                               'rand'
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 90
         11        DO_ICALL                                         $21     
         12        ASSIGN                                                   !4, $21
   21    13        INIT_ARRAY                                       ~23     !4
         14        ASSIGN                                                   !5, ~23
   22    15        ASSIGN                                                   !6, 1
         16      > JMP                                                      ->27
   23    17    >   SUB                                              ~27     !6, 1
         18        FETCH_DIM_R                                      ~28     !5, ~27
         19        MUL                                              ~29     !4, 2
         20        SUB                                              ~30     90, ~29
         21        SUB                                              ~31     !0, 1
         22        DIV                                              ~32     ~30, ~31
         23        ADD                                              ~33     ~28, ~32
         24        ASSIGN_DIM                                               !5, !6
         25        OP_DATA                                                  ~33
   22    26        PRE_INC                                                  !6
         27    >   IS_SMALLER                                               !6, !0
         28      > JMPNZ                                                    ~35, ->17
   26    29    >   ASSIGN                                                   !7, 0
   27    30      > FE_RESET_R                                       $37     !5, ->41
         31    > > FE_FETCH_R                                               $37, !8, ->41
   28    32    >   INIT_FCALL                                               'sin'
         33        INIT_FCALL                                               'pi'
         34        DO_ICALL                                         $38     
         35        MUL                                              ~39     !8, $38
         36        DIV                                              ~40     ~39, 180
         37        SEND_VAL                                                 ~40
         38        DO_ICALL                                         $41     
         39        ASSIGN_OP                                     1          !7, $41
   27    40      > JMP                                                      ->31
         41    >   FE_FREE                                                  $37
   30    42        FETCH_OBJ_R                                      ~43     !3, 'Y'
         43        SUB                                              ~44     ~43, !2
         44        DIV                                              ~45     ~44, !0
         45        ASSIGN                                                   !9, ~45
   32    46        ASSIGN                                                   !10, 0
   33    47      > FE_RESET_R                                       $48     !5, ->58
         48    > > FE_FETCH_R                                               $48, !8, ->58
   34    49    >   INIT_FCALL                                               'cos'
         50        INIT_FCALL                                               'pi'
         51        DO_ICALL                                         $49     
         52        MUL                                              ~50     !8, $49
         53        DIV                                              ~51     ~50, 180
         54        SEND_VAL                                                 ~51
         55        DO_ICALL                                         $52     
         56        ASSIGN_OP                                     1          !10, $52
   33    57      > JMP                                                      ->48
         58    >   FE_FREE                                                  $48
   36    59        FETCH_OBJ_R                                      ~54     !3, 'X'
         60        SUB                                              ~55     ~54, !1
         61        DIV                                              ~56     ~55, !0
         62        ASSIGN                                                   !11, ~56
   38    63        NEW                                              $58     'Point'
         64        SEND_VAR_EX                                              !1
         65        SEND_VAR_EX                                              !2
         66        DO_FCALL                                      0          
         67        INIT_ARRAY                                       ~60     $58
         68        ASSIGN                                                   !12, ~60
   39    69        ASSIGN                                                   !6, 1
         70      > JMP                                                      ->88
   40    71    >   SUB                                              ~63     !6, 1
         72        FETCH_DIM_R                                      ~64     !12, ~63
         73        FETCH_OBJ_R                                      ~65     ~64, 'X'
         74        ADD                                              ~66     ~65, !11
         75        ASSIGN                                                   !13, ~66
   41    76        SUB                                              ~68     !6, 1
         77        FETCH_DIM_R                                      ~69     !12, ~68
         78        FETCH_OBJ_R                                      ~70     ~69, 'Y'
         79        ADD                                              ~71     ~70, !9
         80        ASSIGN                                                   !14, ~71
   42    81        NEW                                              $74     'Point'
         82        SEND_VAR_EX                                              !13
         83        SEND_VAR_EX                                              !14
         84        DO_FCALL                                      0          
         85        ASSIGN_DIM                                               !12
         86        OP_DATA                                                  $74
   39    87        PRE_INC                                                  !6
         88    >   IS_SMALLER_OR_EQUAL                                      !6, !0
         89      > JMPNZ                                                    ~77, ->71
   45    90    >   INIT_FCALL                                               'var_dump'
         91        SEND_VAR                                                 !12
         92        DO_ICALL                                                 
         93      > RETURN                                                   1

Class Point:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SLYWr
function name:  __construct
number of ops:  7
compiled vars:  !0 = $X, !1 = $Y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN_OBJ                                               'X'
          3        OP_DATA                                                  !0
    9     4        ASSIGN_OBJ                                               'Y'
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function __construct

End of class Point.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.48 ms | 1404 KiB | 23 Q