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[] = new test("temp1"); $n[] = new test("temp2"); $n[] = new test("temp3"); $n[] = new test("temp4"); $n[] = new test("temp5"); $n[] = new test("temp6"); $n[] = new test("temp7"); $n[] = new test("temp8"); $n[] = new test("temp9"); print_r( unserialize( $x = serialize( $n ) ) ); var_dump($x, serialize($n) === $x); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AmC5e
function name:  (null)
number of ops:  66
compiled vars:  !0 = $n, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'test'
   20     1        ASSIGN                                                   !0, <array>
   21     2        NEW                                              $4      'test'
          3        SEND_VAL_EX                                              'temp1'
          4        DO_FCALL                                      0          
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $4
   22     7        NEW                                              $7      'test'
          8        SEND_VAL_EX                                              'temp2'
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !0
         11        OP_DATA                                                  $7
   23    12        NEW                                              $10     'test'
         13        SEND_VAL_EX                                              'temp3'
         14        DO_FCALL                                      0          
         15        ASSIGN_DIM                                               !0
         16        OP_DATA                                                  $10
   24    17        NEW                                              $13     'test'
         18        SEND_VAL_EX                                              'temp4'
         19        DO_FCALL                                      0          
         20        ASSIGN_DIM                                               !0
         21        OP_DATA                                                  $13
   25    22        NEW                                              $16     'test'
         23        SEND_VAL_EX                                              'temp5'
         24        DO_FCALL                                      0          
         25        ASSIGN_DIM                                               !0
         26        OP_DATA                                                  $16
   26    27        NEW                                              $19     'test'
         28        SEND_VAL_EX                                              'temp6'
         29        DO_FCALL                                      0          
         30        ASSIGN_DIM                                               !0
         31        OP_DATA                                                  $19
   27    32        NEW                                              $22     'test'
         33        SEND_VAL_EX                                              'temp7'
         34        DO_FCALL                                      0          
         35        ASSIGN_DIM                                               !0
         36        OP_DATA                                                  $22
   28    37        NEW                                              $25     'test'
         38        SEND_VAL_EX                                              'temp8'
         39        DO_FCALL                                      0          
         40        ASSIGN_DIM                                               !0
         41        OP_DATA                                                  $25
   29    42        NEW                                              $28     'test'
         43        SEND_VAL_EX                                              'temp9'
         44        DO_FCALL                                      0          
         45        ASSIGN_DIM                                               !0
         46        OP_DATA                                                  $28
   30    47        INIT_FCALL                                               'print_r'
         48        INIT_FCALL                                               'unserialize'
         49        INIT_FCALL                                               'serialize'
         50        SEND_VAR                                                 !0
         51        DO_ICALL                                         $30     
         52        ASSIGN                                           ~31     !1, $30
         53        SEND_VAL                                                 ~31
         54        DO_ICALL                                         $32     
         55        SEND_VAR                                                 $32
         56        DO_ICALL                                                 
   32    57        INIT_FCALL                                               'var_dump'
         58        SEND_VAR                                                 !1
         59        INIT_FCALL                                               'serialize'
         60        SEND_VAR                                                 !0
         61        DO_ICALL                                         $34     
         62        IS_IDENTICAL                                     ~35     !1, $34
         63        SEND_VAL                                                 ~35
         64        DO_ICALL                                                 
   33    65      > RETURN                                                   1

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AmC5e
function name:  __construct
number of ops:  4
compiled vars:  !0 = $_val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
    8     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/AmC5e
function name:  serialize
number of ops:  15
compiled vars:  !0 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   CAST                                          8  ~1      <array>
          1        ASSIGN                                                   !0, ~1
   12     2        FETCH_OBJ_R                                      ~4      'a'
          3        ASSIGN_OBJ                                               !0, 'a'
          4        OP_DATA                                                  ~4
   13     5        INIT_FCALL                                               'serialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        CONCAT                                           ~6      $5, '%0A'
          9        ECHO                                                     ~6
   14    10        INIT_FCALL                                               'serialize'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $7      
         13      > RETURN                                                   $7
   15    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/AmC5e
function name:  unserialize
number of ops:  2
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     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:
153.22 ms | 1404 KiB | 21 Q