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); echo 'Angle = '.$startAngle."\r\n"; $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 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 20
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 44
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 44
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 44
2 jumps found. (Code = 77) Position 1 = 51, Position 2 = 61
Branch analysis from position: 51
2 jumps found. (Code = 78) Position 1 = 52, Position 2 = 61
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
2 jumps found. (Code = 44) Position 1 = 93, Position 2 = 74
Branch analysis from position: 93
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 93, Position 2 = 74
Branch analysis from position: 93
Branch analysis from position: 74
Branch analysis from position: 61
Branch analysis from position: 44
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 20
Branch analysis from position: 32
Branch analysis from position: 20
filename:       /in/jsG28
function name:  (null)
number of ops:  97
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        CONCAT                                           ~23     'Angle+%3D+', !4
         14        CONCAT                                           ~24     ~23, '%0D%0A'
         15        ECHO                                                     ~24
   23    16        INIT_ARRAY                                       ~25     !4
         17        ASSIGN                                                   !5, ~25
   24    18        ASSIGN                                                   !6, 1
         19      > JMP                                                      ->30
   25    20    >   SUB                                              ~29     !6, 1
         21        FETCH_DIM_R                                      ~30     !5, ~29
         22        MUL                                              ~31     !4, 2
         23        SUB                                              ~32     90, ~31
         24        SUB                                              ~33     !0, 1
         25        DIV                                              ~34     ~32, ~33
         26        ADD                                              ~35     ~30, ~34
         27        ASSIGN_DIM                                               !5, !6
         28        OP_DATA                                                  ~35
   24    29        PRE_INC                                                  !6
         30    >   IS_SMALLER                                               !6, !0
         31      > JMPNZ                                                    ~37, ->20
   28    32    >   ASSIGN                                                   !7, 0
   29    33      > FE_RESET_R                                       $39     !5, ->44
         34    > > FE_FETCH_R                                               $39, !8, ->44
   30    35    >   INIT_FCALL                                               'sin'
         36        INIT_FCALL                                               'pi'
         37        DO_ICALL                                         $40     
         38        MUL                                              ~41     !8, $40
         39        DIV                                              ~42     ~41, 180
         40        SEND_VAL                                                 ~42
         41        DO_ICALL                                         $43     
         42        ASSIGN_OP                                     1          !7, $43
   29    43      > JMP                                                      ->34
         44    >   FE_FREE                                                  $39
   32    45        FETCH_OBJ_R                                      ~45     !3, 'Y'
         46        SUB                                              ~46     ~45, !2
         47        DIV                                              ~47     ~46, !0
         48        ASSIGN                                                   !9, ~47
   34    49        ASSIGN                                                   !10, 0
   35    50      > FE_RESET_R                                       $50     !5, ->61
         51    > > FE_FETCH_R                                               $50, !8, ->61
   36    52    >   INIT_FCALL                                               'cos'
         53        INIT_FCALL                                               'pi'
         54        DO_ICALL                                         $51     
         55        MUL                                              ~52     !8, $51
         56        DIV                                              ~53     ~52, 180
         57        SEND_VAL                                                 ~53
         58        DO_ICALL                                         $54     
         59        ASSIGN_OP                                     1          !10, $54
   35    60      > JMP                                                      ->51
         61    >   FE_FREE                                                  $50
   38    62        FETCH_OBJ_R                                      ~56     !3, 'X'
         63        SUB                                              ~57     ~56, !1
         64        DIV                                              ~58     ~57, !0
         65        ASSIGN                                                   !11, ~58
   40    66        NEW                                              $60     'Point'
         67        SEND_VAR_EX                                              !1
         68        SEND_VAR_EX                                              !2
         69        DO_FCALL                                      0          
         70        INIT_ARRAY                                       ~62     $60
         71        ASSIGN                                                   !12, ~62
   41    72        ASSIGN                                                   !6, 1
         73      > JMP                                                      ->91
   42    74    >   SUB                                              ~65     !6, 1
         75        FETCH_DIM_R                                      ~66     !12, ~65
         76        FETCH_OBJ_R                                      ~67     ~66, 'X'
         77        ADD                                              ~68     ~67, !11
         78        ASSIGN                                                   !13, ~68
   43    79        SUB                                              ~70     !6, 1
         80        FETCH_DIM_R                                      ~71     !12, ~70
         81        FETCH_OBJ_R                                      ~72     ~71, 'Y'
         82        ADD                                              ~73     ~72, !9
         83        ASSIGN                                                   !14, ~73
   44    84        NEW                                              $76     'Point'
         85        SEND_VAR_EX                                              !13
         86        SEND_VAR_EX                                              !14
         87        DO_FCALL                                      0          
         88        ASSIGN_DIM                                               !12
         89        OP_DATA                                                  $76
   41    90        PRE_INC                                                  !6
         91    >   IS_SMALLER_OR_EQUAL                                      !6, !0
         92      > JMPNZ                                                    ~79, ->74
   47    93    >   INIT_FCALL                                               'var_dump'
         94        SEND_VAR                                                 !12
         95        DO_ICALL                                                 
         96      > RETURN                                                   1

Class Point:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jsG28
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:
152.46 ms | 1396 KiB | 23 Q