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]); $z = array_unique($y, SORT_STRING); var_dump(__LINE__); debug_zval_dump($x[0]); debug_zval_dump($y[0]); debug_zval_dump($z[0]); return $z; } } $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/kKqJK
function name:  (null)
number of ops:  20
compiled vars:  !0 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   NEW                                                  $1      'Test'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $1, 'foo'
          3        DO_FCALL                                          0  $3      
          4        ASSIGN                                                       !0, $3
   26     5        INIT_FCALL                                                   'var_dump'
          6        SEND_VAL                                                     26
          7        DO_ICALL                                                     
   27     8        INIT_FCALL                                                   'debug_zval_dump'
          9        FETCH_DIM_R                                          ~6      !0, 0
         10        SEND_VAL                                                     ~6
         11        DO_ICALL                                                     
   28    12        INIT_FCALL                                                   'debug_zval_dump'
         13        FETCH_DIM_R                                          ~8      !0, 1
         14        SEND_VAL                                                     ~8
         15        DO_ICALL                                                     
   29    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/kKqJK
function name:  foo
number of ops:  47
compiled vars:  !0 = $x, !1 = $y, !2 = $z
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                                          ~5      !0, 0
          6        SEND_VAL                                                     ~5
          7        DO_ICALL                                                     
   12     8        INIT_FCALL                                                   'array_map'
          9        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
         10        SEND_VAL                                                     ~7
         11        SEND_VAR                                                     !0
         12        DO_ICALL                                             $8      
         13        ASSIGN                                                       !1, $8
   13    14        INIT_FCALL                                                   'var_dump'
         15        SEND_VAL                                                     13
         16        DO_ICALL                                                     
   14    17        INIT_FCALL                                                   'debug_zval_dump'
         18        FETCH_DIM_R                                          ~11     !0, 0
         19        SEND_VAL                                                     ~11
         20        DO_ICALL                                                     
   15    21        INIT_FCALL                                                   'debug_zval_dump'
         22        FETCH_DIM_R                                          ~13     !1, 0
         23        SEND_VAL                                                     ~13
         24        DO_ICALL                                                     
   16    25        INIT_FCALL                                                   'array_unique'
         26        SEND_VAR                                                     !1
         27        SEND_VAL                                                     2
         28        DO_ICALL                                             $15     
         29        ASSIGN                                                       !2, $15
   17    30        INIT_FCALL                                                   'var_dump'
         31        SEND_VAL                                                     17
         32        DO_ICALL                                                     
   18    33        INIT_FCALL                                                   'debug_zval_dump'
         34        FETCH_DIM_R                                          ~18     !0, 0
         35        SEND_VAL                                                     ~18
         36        DO_ICALL                                                     
   19    37        INIT_FCALL                                                   'debug_zval_dump'
         38        FETCH_DIM_R                                          ~20     !1, 0
         39        SEND_VAL                                                     ~20
         40        DO_ICALL                                                     
   20    41        INIT_FCALL                                                   'debug_zval_dump'
         42        FETCH_DIM_R                                          ~22     !2, 0
         43        SEND_VAL                                                     ~22
         44        DO_ICALL                                                     
   21    45      > RETURN                                                       !2
   22    46*     > 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/kKqJK
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:
231.26 ms | 2226 KiB | 17 Q