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 = 100; $mouseY = 100; $point = new Point(200, 200); $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 - $points[$i-1]->X)*$xCoefs[$i]/$moves; $y = $points[$i-1]->Y + ($point->Y - $points[$i-1]->Y)/$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 = 78
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 80, Position 2 = 47
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 80, Position 2 = 47
Branch analysis from position: 80
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/ZPlAF
function name:  (null)
number of ops:  84
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, 100
   15     2        ASSIGN                                                   !2, 100
   16     3        NEW                                              $13     'Point'
          4        SEND_VAL_EX                                              200
          5        SEND_VAL_EX                                              200
          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                                                      ->78
   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     !6, 1
         52        FETCH_DIM_R                                      ~47     !7, ~46
         53        FETCH_OBJ_R                                      ~48     ~47, 'X'
         54        SUB                                              ~49     ~45, ~48
         55        FETCH_DIM_R                                      ~50     !5, !6
         56        MUL                                              ~51     ~49, ~50
         57        DIV                                              ~52     ~51, !0
         58        ADD                                              ~53     ~44, ~52
         59        ASSIGN                                                   !8, ~53
   31    60        SUB                                              ~55     !6, 1
         61        FETCH_DIM_R                                      ~56     !7, ~55
         62        FETCH_OBJ_R                                      ~57     ~56, 'Y'
         63        FETCH_OBJ_R                                      ~58     !3, 'Y'
         64        SUB                                              ~59     !6, 1
         65        FETCH_DIM_R                                      ~60     !7, ~59
         66        FETCH_OBJ_R                                      ~61     ~60, 'Y'
         67        SUB                                              ~62     ~58, ~61
         68        DIV                                              ~63     ~62, !0
         69        ADD                                              ~64     ~57, ~63
         70        ASSIGN                                                   !9, ~64
   32    71        NEW                                              $67     'Point'
         72        SEND_VAR_EX                                              !8
         73        SEND_VAR_EX                                              !9
         74        DO_FCALL                                      0          
         75        ASSIGN_DIM                                               !7
         76        OP_DATA                                                  $67
   29    77        PRE_INC                                                  !6
         78    >   IS_SMALLER_OR_EQUAL                                      !6, !0
         79      > JMPNZ                                                    ~70, ->47
   35    80    >   INIT_FCALL                                               'var_dump'
         81        SEND_VAR                                                 !7
         82        DO_ICALL                                                 
         83      > RETURN                                                   1

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