3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace A { class Foo { public $prop = 'value'; public static function __set_state($array) { echo '__set_state:', var_dump($array); $obj = new self; $obj->prop = $array['prop']; return $obj; } } function export($what) { $buffer = var_export($what, 1); echo 'export: ', $buffer, "\n"; return $buffer; } function import($that) { echo 'import [eval]: ', var_dump(eval("return $that;")); } } namespace B { function import($that) { echo 'import [eval]: ', var_dump(eval("return $that;")); } } namespace { $a = new A\Foo(); $test = var_export($a, true); echo 'import [eval]: ', var_dump(eval("return $that;")); A\import($test); B\import($test); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGal3
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a, !1 = $test, !2 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $3      'A%5CFoo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   29     3        INIT_FCALL                                               'var_export'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !1, $6
   30     8        ECHO                                                     'import+%5Beval%5D%3A+'
          9        INIT_FCALL                                               'var_dump'
         10        ROPE_INIT                                     3  ~9      'return+'
         11        ROPE_ADD                                      1  ~9      ~9, !2
         12        ROPE_END                                      2  ~8      ~9, '%3B'
         13        INCLUDE_OR_EVAL                                  $11     ~8, EVAL
         14        SEND_VAR                                                 $11
         15        DO_ICALL                                         $12     
         16        ECHO                                                     $12
   31    17        INIT_FCALL                                               'a%5Cimport'
         18        SEND_VAR                                                 !1
         19        DO_FCALL                                      0          
   32    20        INIT_FCALL                                               'b%5Cimport'
         21        SEND_VAR                                                 !1
         22        DO_FCALL                                      0          
   33    23      > RETURN                                                   1

Function a%5Cexport:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGal3
function name:  A\export
number of ops:  11
compiled vars:  !0 = $what, !1 = $buffer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_NS_FCALL_BY_NAME                                    'A%5Cvar_export'
          2        SEND_VAR_EX                                              !0
          3        SEND_VAL_EX                                              1
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !1, $2
   15     6        ECHO                                                     'export%3A+'
          7        ECHO                                                     !1
          8        ECHO                                                     '%0A'
   16     9      > RETURN                                                   !1
   17    10*     > RETURN                                                   null

End of function a%5Cexport

Function a%5Cimport:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGal3
function name:  A\import
number of ops:  11
compiled vars:  !0 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        ECHO                                                     'import+%5Beval%5D%3A+'
          2        INIT_NS_FCALL_BY_NAME                                    'A%5Cvar_dump'
          3        ROPE_INIT                                     3  ~2      'return+'
          4        ROPE_ADD                                      1  ~2      ~2, !0
          5        ROPE_END                                      2  ~1      ~2, '%3B'
          6        INCLUDE_OR_EVAL                                  $4      ~1, EVAL
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0  $5      
          9        ECHO                                                     $5
   20    10      > RETURN                                                   null

End of function a%5Cimport

Function b%5Cimport:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGal3
function name:  B\import
number of ops:  11
compiled vars:  !0 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        ECHO                                                     'import+%5Beval%5D%3A+'
          2        INIT_NS_FCALL_BY_NAME                                    'B%5Cvar_dump'
          3        ROPE_INIT                                     3  ~2      'return+'
          4        ROPE_ADD                                      1  ~2      ~2, !0
          5        ROPE_END                                      2  ~1      ~2, '%3B'
          6        INCLUDE_OR_EVAL                                  $4      ~1, EVAL
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0  $5      
          9        ECHO                                                     $5
   25    10      > RETURN                                                   null

End of function b%5Cimport

Class A\Foo:
Function __set_state:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGal3
function name:  __set_state
number of ops:  14
compiled vars:  !0 = $array, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ECHO                                                     '__set_state%3A'
          2        INIT_NS_FCALL_BY_NAME                                    'A%5Cvar_dump'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
    7     6        NEW                          self                $3      
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $3
    8     9        FETCH_DIM_R                                      ~7      !0, 'prop'
         10        ASSIGN_OBJ                                               !1, 'prop'
         11        OP_DATA                                                  ~7
    9    12      > RETURN                                                   !1
   10    13*     > RETURN                                                   null

End of function __set_state

End of class A\Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.13 ms | 1403 KiB | 19 Q