3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = (object) [ 'foo' => 'bar', 'foo2' => 'bar2' ]; $coll = collect($obj); var_dump($coll[0]); // returns object // but what about... // $coll->foo // Or dump($coll[0]) .. // The end goal is object in ... do collection stuff on it ... object out. // This is not possible without ->toArray and then (object) on that array.
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HWcoZ
function name:  (null)
number of ops:  11
compiled vars:  !0 = $obj, !1 = $coll
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   CAST                                          8  ~2      <array>
    4     1        ASSIGN                                                   !0, ~2
    9     2        INIT_FCALL_BY_NAME                                       'collect'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   11     6        INIT_FCALL                                               'var_dump'
          7        FETCH_DIM_R                                      ~6      !1, 0
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
   20    10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.05 ms | 1009 KiB | 14 Q