3v4l.org

run code in 300+ PHP versions simultaneously
<?php class newsCollection { private $collection; private $keys = [ "headline", "date", "author", ]; public function __construct($data) { foreach ($data as &$el) { $el = array_combine($this->keys, $el); } $this->collection = $data; } public function getNewsCollection() { return $this->collection; } } $sports = [ [ "Boston Red Sox vs New York Yankees - 9-3", "19.06.2017", "ESPN" ], [ "Boston Patriot QB breaks new record!", "16.07.2017", "NESN" ], [ "Celtics coach John Doe inducted into hall of fame", "25.07.2017", "Fox Sports" ], [ "Boston Brewins win 16-5 against New York's Rangers", "21.08.2017", "NESN" ] ]; $c = new newsCollection($sports); var_dump($c->getNewsCollection());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AIeUq
function name:  (null)
number of ops:  11
compiled vars:  !0 = $sports, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ASSIGN                                                   !0, <array>
   47     1        NEW                                              $3      'newsCollection'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   48     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !1, 'getNewsCollection'
          7        DO_FCALL                                      0  $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class newsCollection:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/AIeUq
function name:  __construct
number of ops:  14
compiled vars:  !0 = $data, !1 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1      > FE_RESET_RW                                      $2      !0, ->10
          2    > > FE_FETCH_RW                                              $2, !1, ->10
   14     3    >   INIT_FCALL                                               'array_combine'
          4        FETCH_OBJ_R                                      ~3      'keys'
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   13     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $2
   17    11        ASSIGN_OBJ                                               'collection'
         12        OP_DATA                                                  !0
   18    13      > RETURN                                                   null

End of function __construct

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

End of function getnewscollection

End of class newsCollection.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.5 ms | 1000 KiB | 15 Q