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-1); } echo $delta.' -> '.(1/$delta)."\r\n"; var_dump($xCoefs); $points = array(new Point($mouseX, $mouseY)); for ( $i=1; $i<=$moves; $i++ ) { $x = $points[$i-1]->X + ($point->X - $mouseX)*$xCoefs[$i-1]/$moves; $y = $points[$i-1]->Y + ($point->Y - $mouseY)/$moves; echo $x.';'.$y.' (coef '.$xCoefs[$i-1].')'."\r\n"; $points[] = new Point($x, $y); }
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 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 28
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
2 jumps found. (Code = 44) Position 1 = 93, Position 2 = 56
Branch analysis from position: 93
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 93, Position 2 = 56
Branch analysis from position: 93
Branch analysis from position: 56
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 28
Branch analysis from position: 40
Branch analysis from position: 28
Branch analysis from position: 24
filename:       /in/QehRZ
function name:  (null)
number of ops:  94
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                                                      ->38
   24    28    >   SUB                                              ~29     !6, 1
         29        FETCH_DIM_R                                      ~30     !5, ~29
         30        DIV                                              ~31     1, !4
         31        SUB                                              ~32     !4, ~31
         32        SUB                                              ~33     !0, 1
         33        DIV                                              ~34     ~32, ~33
         34        SUB                                              ~35     ~30, ~34
         35        ASSIGN_DIM                                               !5, !6
         36        OP_DATA                                                  ~35
   23    37        PRE_INC                                                  !6
         38    >   IS_SMALLER                                               !6, !0
         39      > JMPNZ                                                    ~37, ->28
   26    40    >   CONCAT                                           ~38     !4, '+-%3E+'
         41        DIV                                              ~39     1, !4
         42        CONCAT                                           ~40     ~38, ~39
         43        CONCAT                                           ~41     ~40, '%0D%0A'
         44        ECHO                                                     ~41
   27    45        INIT_FCALL                                               'var_dump'
         46        SEND_VAR                                                 !5
         47        DO_ICALL                                                 
   30    48        NEW                                              $43     'Point'
         49        SEND_VAR_EX                                              !1
         50        SEND_VAR_EX                                              !2
         51        DO_FCALL                                      0          
         52        INIT_ARRAY                                       ~45     $43
         53        ASSIGN                                                   !7, ~45
   31    54        ASSIGN                                                   !6, 1
         55      > JMP                                                      ->91
   32    56    >   SUB                                              ~48     !6, 1
         57        FETCH_DIM_R                                      ~49     !7, ~48
         58        FETCH_OBJ_R                                      ~50     ~49, 'X'
         59        FETCH_OBJ_R                                      ~51     !3, 'X'
         60        SUB                                              ~52     ~51, !1
         61        SUB                                              ~53     !6, 1
         62        FETCH_DIM_R                                      ~54     !5, ~53
         63        MUL                                              ~55     ~52, ~54
         64        DIV                                              ~56     ~55, !0
         65        ADD                                              ~57     ~50, ~56
         66        ASSIGN                                                   !8, ~57
   33    67        SUB                                              ~59     !6, 1
         68        FETCH_DIM_R                                      ~60     !7, ~59
         69        FETCH_OBJ_R                                      ~61     ~60, 'Y'
         70        FETCH_OBJ_R                                      ~62     !3, 'Y'
         71        SUB                                              ~63     ~62, !2
         72        DIV                                              ~64     ~63, !0
         73        ADD                                              ~65     ~61, ~64
         74        ASSIGN                                                   !9, ~65
   34    75        CONCAT                                           ~67     !8, '%3B'
         76        CONCAT                                           ~68     ~67, !9
         77        CONCAT                                           ~69     ~68, '+%28coef+'
         78        SUB                                              ~70     !6, 1
         79        FETCH_DIM_R                                      ~71     !5, ~70
         80        CONCAT                                           ~72     ~69, ~71
         81        CONCAT                                           ~73     ~72, '%29'
         82        CONCAT                                           ~74     ~73, '%0D%0A'
         83        ECHO                                                     ~74
   35    84        NEW                                              $76     'Point'
         85        SEND_VAR_EX                                              !8
         86        SEND_VAR_EX                                              !9
         87        DO_FCALL                                      0          
         88        ASSIGN_DIM                                               !7
         89        OP_DATA                                                  $76
   31    90        PRE_INC                                                  !6
         91    >   IS_SMALLER_OR_EQUAL                                      !6, !0
         92      > JMPNZ                                                    ~79, ->56
   36    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/QehRZ
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:
147.81 ms | 1404 KiB | 17 Q