3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $box; public function setBox(array $box) { if (count($box) !== 4) { throw new InvalidArgumentException('The "$box" parameter must be an array with 4 values.'); } // Breaks FPM and gives a 502 due to connection reset by peers //list($lat1, $lon1, $lat2, $lon2) = $this->box = $box' // Works perfectly fine $this->box = $box; list($lat1, $lon1, $lat2, $lon2) = $this->box; // Calculate the central point of the box for distances $this->lat = (float) $lat1 + (($lat2 - $lat1) / 2); $this->lon = (float) $lon1 + (($lon2 - $lon1) / 2); return $this; } public function process() { if ($this->box) { list($lat1, $lon1, $lat2, $lon2) = $this->box; } echo "Success"; } } $foo = new Foo; $foo->setBox(explode(',', '40.688235,-74.013718,40.756427,-73.958770')); $foo->process();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QEJVS
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   39     3        INIT_METHOD_CALL                                         !0, 'setBox'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2C'
          6        SEND_VAL                                                 '40.688235%2C-74.013718%2C40.756427%2C-73.958770'
          7        DO_ICALL                                         $4      
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0          
   40    10        INIT_METHOD_CALL                                         !0, 'process'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Class Foo:
Function setbox:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QEJVS
function name:  setBox
number of ops:  35
compiled vars:  !0 = $box, !1 = $lat1, !2 = $lon1, !3 = $lat2, !4 = $lon2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        COUNT                                            ~5      !0
          2        IS_NOT_IDENTICAL                                         ~5, 4
          3      > JMPZ                                                     ~6, ->8
    9     4    >   NEW                                              $7      'InvalidArgumentException'
          5        SEND_VAL_EX                                              'The+%22%24box%22+parameter+must+be+an+array+with+4+values.'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $7
   16     8    >   ASSIGN_OBJ                                               'box'
          9        OP_DATA                                                  !0
   17    10        FETCH_OBJ_R                                      ~10     'box'
         11        FETCH_LIST_R                                     $11     ~10, 0
         12        ASSIGN                                                   !1, $11
         13        FETCH_LIST_R                                     $13     ~10, 1
         14        ASSIGN                                                   !2, $13
         15        FETCH_LIST_R                                     $15     ~10, 2
         16        ASSIGN                                                   !3, $15
         17        FETCH_LIST_R                                     $17     ~10, 3
         18        ASSIGN                                                   !4, $17
         19        FREE                                                     ~10
   20    20        CAST                                          5  ~20     !1
         21        SUB                                              ~21     !3, !1
         22        DIV                                              ~22     ~21, 2
         23        ADD                                              ~23     ~20, ~22
         24        ASSIGN_OBJ                                               'lat'
         25        OP_DATA                                                  ~23
   21    26        CAST                                          5  ~25     !2
         27        SUB                                              ~26     !4, !2
         28        DIV                                              ~27     ~26, 2
         29        ADD                                              ~28     ~25, ~27
         30        ASSIGN_OBJ                                               'lon'
         31        OP_DATA                                                  ~28
   23    32        FETCH_THIS                                       ~29     
         33      > RETURN                                                   ~29
   24    34*     > RETURN                                                   null

End of function setbox

Function process:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/QEJVS
function name:  process
number of ops:  14
compiled vars:  !0 = $lat1, !1 = $lon1, !2 = $lat2, !3 = $lon2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   FETCH_OBJ_R                                      ~4      'box'
          1      > JMPZ                                                     ~4, ->12
   30     2    >   FETCH_OBJ_R                                      ~5      'box'
          3        FETCH_LIST_R                                     $6      ~5, 0
          4        ASSIGN                                                   !0, $6
          5        FETCH_LIST_R                                     $8      ~5, 1
          6        ASSIGN                                                   !1, $8
          7        FETCH_LIST_R                                     $10     ~5, 2
          8        ASSIGN                                                   !2, $10
          9        FETCH_LIST_R                                     $12     ~5, 3
         10        ASSIGN                                                   !3, $12
         11        FREE                                                     ~5
   33    12    >   ECHO                                                     'Success'
   34    13      > RETURN                                                   null

End of function process

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.94 ms | 1400 KiB | 15 Q