3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class Filter { private $filters = []; public function addIds($ids) { if (empty($this->filters['id'])) { // A single ID $this->filters['id'] = $ids; } else { // Multiple IDs. Append new ids $this->filters['id'] = array_unique(array_merge( (array)$this->filters['id'], (array)$ids )); } } public function getFilters() { return $this->filters; } } $filter = new Filter(); $filter->addIds(1); $filter->addIds(22); $filter->addIds(2); $filter->addIds([4,3,2,1,0]); var_dump($filter->getFilters());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gtdlh
function name:  (null)
number of ops:  21
compiled vars:  !0 = $filter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'Filter'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_METHOD_CALL                                         !0, 'addIds'
          4        SEND_VAL_EX                                              1
          5        DO_FCALL                                      0          
   30     6        INIT_METHOD_CALL                                         !0, 'addIds'
          7        SEND_VAL_EX                                              22
          8        DO_FCALL                                      0          
   31     9        INIT_METHOD_CALL                                         !0, 'addIds'
         10        SEND_VAL_EX                                              2
         11        DO_FCALL                                      0          
   32    12        INIT_METHOD_CALL                                         !0, 'addIds'
         13        SEND_VAL_EX                                              <array>
         14        DO_FCALL                                      0          
   34    15        INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !0, 'getFilters'
         17        DO_FCALL                                      0  $8      
         18        SEND_VAR                                                 $8
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Class Filter:
Function addids:
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 = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gtdlh
function name:  addIds
number of ops:  23
compiled vars:  !0 = $ids
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        FETCH_OBJ_IS                                     ~1      'filters'
          2        ISSET_ISEMPTY_DIM_OBJ                         1          ~1, 'id'
          3      > JMPZ                                                     ~2, ->8
   12     4    >   FETCH_OBJ_W                                      $3      'filters'
          5        ASSIGN_DIM                                               $3, 'id'
          6        OP_DATA                                                  !0
          7      > JMP                                                      ->22
   17     8    >   INIT_FCALL                                               'array_unique'
          9        INIT_FCALL                                               'array_merge'
         10        FETCH_OBJ_R                                      ~7      'filters'
         11        FETCH_DIM_R                                      ~8      ~7, 'id'
         12        CAST                                          7  ~9      ~8
         13        SEND_VAL                                                 ~9
         14        CAST                                          7  ~10     !0
         15        SEND_VAL                                                 ~10
         16        DO_ICALL                                         $11     
         17        SEND_VAR                                                 $11
         18        DO_ICALL                                         $12     
         19        FETCH_OBJ_W                                      $5      'filters'
         20        ASSIGN_DIM                                               $5, 'id'
         21        OP_DATA                                                  $12
   20    22    > > RETURN                                                   null

End of function addids

Function getfilters:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gtdlh
function name:  getFilters
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   FETCH_OBJ_R                                      ~0      'filters'
          1      > RETURN                                                   ~0
   25     2*     > RETURN                                                   null

End of function getfilters

End of class Filter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.18 ms | 1400 KiB | 19 Q