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 ); } } $n = array(); $n[0] = new test('tmp1'); $n[1] = new test('tmp2'); print_r( unserialize( serialize( $n ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HLe0U
function name:  (null)
number of ops:  22
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'test'
   17     1        ASSIGN                                                   !0, <array>
   18     2        NEW                                              $3      'test'
          3        SEND_VAL_EX                                              'tmp1'
          4        DO_FCALL                                      0          
          5        ASSIGN_DIM                                               !0, 0
          6        OP_DATA                                                  $3
   19     7        NEW                                              $6      'test'
          8        SEND_VAL_EX                                              'tmp2'
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !0, 1
         11        OP_DATA                                                  $6
   20    12        INIT_FCALL                                               'print_r'
         13        INIT_FCALL                                               'unserialize'
         14        INIT_FCALL                                               'serialize'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                         $9      
         19        SEND_VAR                                                 $9
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HLe0U
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/HLe0U
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

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.93 ms | 1400 KiB | 19 Q