3v4l.org

run code in 300+ PHP versions simultaneously
<?php class GeoCoder { protected $latitude; protected $longitude; public $distance; public function __construct($lat,$long,$dist) { $this->latitude = $lat; $this->longitude = $long; $this->distance = $dist; } } $o1 = new GeoCoder(-22.43,-46.81,1500.00); $o2 = new GeoCoder(-22.42,-46.82,1740.00); $o3 = new GeoCoder(-21.43,-46.80,152.00); $nu = null; if ($o1->distance > $o2->distance) { $nu[] = $o2; $nu[] = $o1; } else { $nu[0] = $o1; $nu[1] = $o2; } if ($o2->distance > $o3->distance) { $nu[] = $o3; $nu[] = $o2; } else { $nu[2] = $o2; $nu[3] = $o3; } var_dump($nu);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
Branch analysis from position: 41
filename:       /in/tGoV7
function name:  (null)
number of ops:  49
compiled vars:  !0 = $o1, !1 = $o2, !2 = $o3, !3 = $nu
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $4      'GeoCoder'
          1        SEND_VAL_EX                                              -22.43
          2        SEND_VAL_EX                                              -46.81
          3        SEND_VAL_EX                                              1500
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
   16     6        NEW                                              $7      'GeoCoder'
          7        SEND_VAL_EX                                              -22.42
          8        SEND_VAL_EX                                              -46.82
          9        SEND_VAL_EX                                              1740
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $7
   17    12        NEW                                              $10     'GeoCoder'
         13        SEND_VAL_EX                                              -21.43
         14        SEND_VAL_EX                                              -46.8
         15        SEND_VAL_EX                                              152
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !2, $10
   19    18        ASSIGN                                                   !3, null
   20    19        FETCH_OBJ_R                                      ~14     !0, 'distance'
         20        FETCH_OBJ_R                                      ~15     !1, 'distance'
         21        IS_SMALLER                                               ~15, ~14
         22      > JMPZ                                                     ~16, ->28
   21    23    >   ASSIGN_DIM                                               !3
         24        OP_DATA                                                  !1
   22    25        ASSIGN_DIM                                               !3
         26        OP_DATA                                                  !0
         27      > JMP                                                      ->32
   26    28    >   ASSIGN_DIM                                               !3, 0
         29        OP_DATA                                                  !0
   27    30        ASSIGN_DIM                                               !3, 1
         31        OP_DATA                                                  !1
   29    32    >   FETCH_OBJ_R                                      ~21     !1, 'distance'
         33        FETCH_OBJ_R                                      ~22     !2, 'distance'
         34        IS_SMALLER                                               ~22, ~21
         35      > JMPZ                                                     ~23, ->41
   30    36    >   ASSIGN_DIM                                               !3
         37        OP_DATA                                                  !2
   31    38        ASSIGN_DIM                                               !3
         39        OP_DATA                                                  !1
         40      > JMP                                                      ->45
   35    41    >   ASSIGN_DIM                                               !3, 2
         42        OP_DATA                                                  !1
   36    43        ASSIGN_DIM                                               !3, 3
         44        OP_DATA                                                  !2
   39    45    >   INIT_FCALL                                               'var_dump'
         46        SEND_VAR                                                 !3
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

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

End of function __construct

End of class GeoCoder.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.93 ms | 1400 KiB | 15 Q