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); $delta = 1/(1-rand(0, 99)/100); if (rand(0, 1) == 0) { $delta = 1/$delta; } $xCoefs = array($delta); for ( $i=1; $i<=$moves; $i++ ) { $xCoefs[$i] = $xCoefs[$i-1] - ($delta - 1/$delta)/$moves; } $points = array(new Point($mouseX, $mouseY)); for ( $i=1; $i<=$moves; $i++ ) { $x = $points[$i-1]->X + ($point->X - $mouseX)*$xCoefs[$i]/$moves; $y = $points[$i-1]->Y + ($point->Y - $mouseY)/$moves; $points[] = new Point($x, $y); } var_dump($points);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 28
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 47
Branch analysis from position: 74
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 47
Branch analysis from position: 74
Branch analysis from position: 47
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 28
Branch analysis from position: 39
Branch analysis from position: 28
Branch analysis from position: 24
filename:       /in/5OSC0
function name:  (null)
number of ops:  78
compiled vars:  !0 = $moves, !1 = $mouseX, !2 = $mouseY, !3 = $point, !4 = $delta, !5 = $xCoefs, !6 = $i, !7 = $points, !8 = $x, !9 = $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                                              $13     'Point'
          4        SEND_VAL_EX                                              300
          5        SEND_VAL_EX                                              300
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !3, $13
   18     8        INIT_FCALL                                               'rand'
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 99
         11        DO_ICALL                                         $16     
         12        DIV                                              ~17     $16, 100
         13        SUB                                              ~18     1, ~17
         14        DIV                                              ~19     1, ~18
         15        ASSIGN                                                   !4, ~19
   19    16        INIT_FCALL                                               'rand'
         17        SEND_VAL                                                 0
         18        SEND_VAL                                                 1
         19        DO_ICALL                                         $21     
         20        IS_EQUAL                                                 $21, 0
         21      > JMPZ                                                     ~22, ->24
   20    22    >   DIV                                              ~23     1, !4
         23        ASSIGN                                                   !4, ~23
   22    24    >   INIT_ARRAY                                       ~25     !4
         25        ASSIGN                                                   !5, ~25
   23    26        ASSIGN                                                   !6, 1
         27      > JMP                                                      ->37
   24    28    >   SUB                                              ~29     !6, 1
         29        FETCH_DIM_R                                      ~30     !5, ~29
         30        DIV                                              ~31     1, !4
         31        SUB                                              ~32     !4, ~31
         32        DIV                                              ~33     ~32, !0
         33        SUB                                              ~34     ~30, ~33
         34        ASSIGN_DIM                                               !5, !6
         35        OP_DATA                                                  ~34
   23    36        PRE_INC                                                  !6
         37    >   IS_SMALLER_OR_EQUAL                                      !6, !0
         38      > JMPNZ                                                    ~36, ->28
   28    39    >   NEW                                              $37     'Point'
         40        SEND_VAR_EX                                              !1
         41        SEND_VAR_EX                                              !2
         42        DO_FCALL                                      0          
         43        INIT_ARRAY                                       ~39     $37
         44        ASSIGN                                                   !7, ~39
   29    45        ASSIGN                                                   !6, 1
         46      > JMP                                                      ->72
   30    47    >   SUB                                              ~42     !6, 1
         48        FETCH_DIM_R                                      ~43     !7, ~42
         49        FETCH_OBJ_R                                      ~44     ~43, 'X'
         50        FETCH_OBJ_R                                      ~45     !3, 'X'
         51        SUB                                              ~46     ~45, !1
         52        FETCH_DIM_R                                      ~47     !5, !6
         53        MUL                                              ~48     ~46, ~47
         54        DIV                                              ~49     ~48, !0
         55        ADD                                              ~50     ~44, ~49
         56        ASSIGN                                                   !8, ~50
   31    57        SUB                                              ~52     !6, 1
         58        FETCH_DIM_R                                      ~53     !7, ~52
         59        FETCH_OBJ_R                                      ~54     ~53, 'Y'
         60        FETCH_OBJ_R                                      ~55     !3, 'Y'
         61        SUB                                              ~56     ~55, !2
         62        DIV                                              ~57     ~56, !0
         63        ADD                                              ~58     ~54, ~57
         64        ASSIGN                                                   !9, ~58
   32    65        NEW                                              $61     'Point'
         66        SEND_VAR_EX                                              !8
         67        SEND_VAR_EX                                              !9
         68        DO_FCALL                                      0          
         69        ASSIGN_DIM                                               !7
         70        OP_DATA                                                  $61
   29    71        PRE_INC                                                  !6
         72    >   IS_SMALLER_OR_EQUAL                                      !6, !0
         73      > JMPNZ                                                    ~64, ->47
   35    74    >   INIT_FCALL                                               'var_dump'
         75        SEND_VAR                                                 !7
         76        DO_ICALL                                                 
         77      > RETURN                                                   1

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