3v4l.org

run code in 500+ PHP versions simultaneously
<?php //class Foo class Foo implements \Serializable { public $a = 'lorem'; public function __wakeup() { fprintf(STDOUT, "in %s\n", __METHOD__); } public function serialize() { fprintf(STDOUT, "in %s\n", __METHOD__); return serialize([ $this->a, ]); } public function unserialize($serialized) { fprintf(STDOUT, "in %s\n", __METHOD__); list( $this->a, ) = unserialize($serialized); } } //$foo = new Foo(); //var_dump(serialize($foo)); //exit; $serialised = 'O:3:"Foo":1:{s:1:"a";s:5:"lorem";}'; //$serialised = 'C:3:"Foo":22:{a:1:{i:0;s:5:"lorem";}}'; $foo = unserialize($serialised); var_dump($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SHaCP
function name:  (null)
number of ops:  10
compiled vars:  !0 = $serialised, !1 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                                'foo'
   36     1        ASSIGN                                                       !0, 'O%3A3%3A%22Foo%22%3A1%3A%7Bs%3A1%3A%22a%22%3Bs%3A5%3A%22lorem%22%3B%7D'
   39     2        INIT_FCALL                                                   'unserialize'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $3      
          5        ASSIGN                                                       !1, $3
   40     6        INIT_FCALL                                                   'var_dump'
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                                     
          9      > RETURN                                                       1

Class Foo:
Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SHaCP
function name:  __wakeup
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                                   'fprintf'
          1        FETCH_CONSTANT                                       ~0      'STDOUT'
          2        SEND_VAL                                                     ~0
          3        SEND_VAL                                                     'in+%25s%0A'
          4        SEND_VAL                                                     'Foo%3A%3A__wakeup'
          5        DO_ICALL                                                     
   11     6      > RETURN                                                       null

End of function __wakeup

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SHaCP
function name:  serialize
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                                   'fprintf'
          1        FETCH_CONSTANT                                       ~0      'STDOUT'
          2        SEND_VAL                                                     ~0
          3        SEND_VAL                                                     'in+%25s%0A'
          4        SEND_VAL                                                     'Foo%3A%3Aserialize'
          5        DO_ICALL                                                     
   17     6        INIT_FCALL                                                   'serialize'
   18     7        FETCH_OBJ_R                                          ~2      'a'
          8        INIT_ARRAY                                           ~3      ~2
          9        SEND_VAL                                                     ~3
   17    10        DO_ICALL                                             $4      
   18    11      > RETURN                                                       $4
   20    12*     > 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/SHaCP
function name:  unserialize
number of ops:  15
compiled vars:  !0 = $serialized
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   RECV                                                 !0      
   24     1        INIT_FCALL                                                   'fprintf'
          2        FETCH_CONSTANT                                       ~1      'STDOUT'
          3        SEND_VAL                                                     ~1
          4        SEND_VAL                                                     'in+%25s%0A'
          5        SEND_VAL                                                     'Foo%3A%3Aunserialize'
          6        DO_ICALL                                                     
   28     7        INIT_FCALL                                                   'unserialize'
          8        SEND_VAR                                                     !0
          9        DO_ICALL                                             $3      
         10        FETCH_LIST_R                                         $4      $3, 0
   27    11        ASSIGN_OBJ                                                   'a'
   28    12        OP_DATA                                                      $4
         13        FREE                                                         $3
   29    14      > RETURN                                                       null

End of function unserialize

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.87 ms | 2087 KiB | 17 Q