3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Test { public function foo() { $x = ['foo', 'bar']; // The actual operation isn't important, just need to do something to turn the literal // strings into refcounted strings var_dump(__LINE__); debug_zval_dump($x[0]); $y = array_map(function($it) { return $it.$it; }, $x); var_dump(__LINE__); debug_zval_dump($x[0]); debug_zval_dump($y[0]); return array_unique($y, SORT_STRING); } } $result = (new Test())->foo(); var_dump(__LINE__); debug_zval_dump($result[0]); debug_zval_dump($result[1]); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UvYaH
function name:  (null)
number of ops:  20
compiled vars:  !0 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   NEW                                                  $1      'Test'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $1, 'foo'
          3        DO_FCALL                                          0  $3      
          4        ASSIGN                                                       !0, $3
   21     5        INIT_FCALL                                                   'var_dump'
          6        SEND_VAL                                                     21
          7        DO_ICALL                                                     
   22     8        INIT_FCALL                                                   'debug_zval_dump'
          9        FETCH_DIM_R                                          ~6      !0, 0
         10        SEND_VAL                                                     ~6
         11        DO_ICALL                                                     
   23    12        INIT_FCALL                                                   'debug_zval_dump'
         13        FETCH_DIM_R                                          ~8      !0, 1
         14        SEND_VAL                                                     ~8
         15        DO_ICALL                                                     
   24    16        INIT_FCALL                                                   'var_dump'
         17        SEND_VAR                                                     !0
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

Class Test:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UvYaH
function name:  foo
number of ops:  31
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                       !0, <array>
   10     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAL                                                     10
          3        DO_ICALL                                                     
   11     4        INIT_FCALL                                                   'debug_zval_dump'
          5        FETCH_DIM_R                                          ~4      !0, 0
          6        SEND_VAL                                                     ~4
          7        DO_ICALL                                                     
   12     8        INIT_FCALL                                                   'array_map'
          9        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
         10        SEND_VAL                                                     ~6
         11        SEND_VAR                                                     !0
         12        DO_ICALL                                             $7      
         13        ASSIGN                                                       !1, $7
   13    14        INIT_FCALL                                                   'var_dump'
         15        SEND_VAL                                                     13
         16        DO_ICALL                                                     
   14    17        INIT_FCALL                                                   'debug_zval_dump'
         18        FETCH_DIM_R                                          ~10     !0, 0
         19        SEND_VAL                                                     ~10
         20        DO_ICALL                                                     
   15    21        INIT_FCALL                                                   'debug_zval_dump'
         22        FETCH_DIM_R                                          ~12     !1, 0
         23        SEND_VAL                                                     ~12
         24        DO_ICALL                                                     
   16    25        INIT_FCALL                                                   'array_unique'
         26        SEND_VAR                                                     !1
         27        SEND_VAL                                                     2
         28        DO_ICALL                                             $14     
         29      > RETURN                                                       $14
   17    30*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UvYaH
function name:  {closure:Test::foo():12}
number of ops:  4
compiled vars:  !0 = $it
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
          1        CONCAT                                               ~1      !0, !0
          2      > RETURN                                                       ~1
          3*     > RETURN                                                       null

End of Dynamic Function 0

End of function foo

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.88 ms | 2731 KiB | 17 Q