3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testA implements \Serializable { private $b = 123; public $a = 4; public function test() { $this->b = 1234; } public function serialize() { return serialize(array("a" => $this->a, "b" => $this->b)); } public function unserialize($str) { $ar = unserialize($str); $this->a = $ar['a']; $this->b = $ar['b']; } } $className = "testA"; $object = unserialize( sprintf('O:%d:"%s":0:{}', strlen($className), $className) ); var_dump($object);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SKShm
function name:  (null)
number of ops:  16
compiled vars:  !0 = $className, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'testa'
   27     1        ASSIGN                                                   !0, 'testA'
   29     2        INIT_FCALL                                               'unserialize'
   30     3        INIT_FCALL                                               'sprintf'
          4        SEND_VAL                                                 'O%3A%25d%3A%22%25s%22%3A0%3A%7B%7D'
          5        STRLEN                                           ~3      !0
          6        SEND_VAL                                                 ~3
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                         $5      
   29    11        ASSIGN                                                   !1, $5
   34    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class testA:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SKShm
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN_OBJ                                               'b'
          1        OP_DATA                                                  1234
   11     2      > RETURN                                                   null

End of function test

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SKShm
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'a'
          2        INIT_ARRAY                                       ~1      ~0, 'a'
          3        FETCH_OBJ_R                                      ~2      'b'
          4        ADD_ARRAY_ELEMENT                                ~1      ~2, 'b'
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   16     8*     > 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/SKShm
function name:  unserialize
number of ops:  12
compiled vars:  !0 = $str, !1 = $ar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        INIT_FCALL                                               'unserialize'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   21     5        FETCH_DIM_R                                      ~5      !1, 'a'
          6        ASSIGN_OBJ                                               'a'
          7        OP_DATA                                                  ~5
   22     8        FETCH_DIM_R                                      ~7      !1, 'b'
          9        ASSIGN_OBJ                                               'b'
         10        OP_DATA                                                  ~7
   23    11      > RETURN                                                   null

End of function unserialize

End of class testA.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.61 ms | 1400 KiB | 21 Q