3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test implements Serializable { public $a; public function __construct( $_val ){ $this->a = $_val; } public function serialize() { $tmp = (object) array(); $tmp->a = $this->a; echo serialize( $tmp ) . "\n"; return serialize( $tmp ); } public function unserialize($var) {} } $n = array(); $n[0] = new test('tmp1'); $n[1] = new test('tmp2'); print_r( unserialize( $x = serialize( $n ) ) ); var_dump($x);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cv9ME
function name:  (null)
number of ops:  26
compiled vars:  !0 = $n, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'test'
   18     1        ASSIGN                                                   !0, <array>
   19     2        NEW                                              $4      'test'
          3        SEND_VAL_EX                                              'tmp1'
          4        DO_FCALL                                      0          
          5        ASSIGN_DIM                                               !0, 0
          6        OP_DATA                                                  $4
   20     7        NEW                                              $7      'test'
          8        SEND_VAL_EX                                              'tmp2'
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !0, 1
         11        OP_DATA                                                  $7
   21    12        INIT_FCALL                                               'print_r'
         13        INIT_FCALL                                               'unserialize'
         14        INIT_FCALL                                               'serialize'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $9      
         17        ASSIGN                                           ~10     !1, $9
         18        SEND_VAL                                                 ~10
         19        DO_ICALL                                         $11     
         20        SEND_VAR                                                 $11
         21        DO_ICALL                                                 
   22    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cv9ME
function name:  __construct
number of ops:  4
compiled vars:  !0 = $_val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cv9ME
function name:  serialize
number of ops:  15
compiled vars:  !0 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   CAST                                          8  ~1      <array>
          1        ASSIGN                                                   !0, ~1
   11     2        FETCH_OBJ_R                                      ~4      'a'
          3        ASSIGN_OBJ                                               !0, 'a'
          4        OP_DATA                                                  ~4
   12     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        CONCAT                                           ~6      $5, '%0A'
          9        ECHO                                                     ~6
   13    10        INIT_FCALL                                               'serialize'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $7      
         13      > RETURN                                                   $7
   14    14*     > RETURN                                                   null

End of function serialize

Function unserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cv9ME
function name:  unserialize
number of ops:  2
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function unserialize

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.77 ms | 1400 KiB | 21 Q