3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tablier { public function __construct(public float $longueur, public float $largeur){ } } class Pont { private closure $taille ; public function __sleep() { return array('name','tablier'); } public function __wakeup() { $this->taille = fn() => $this->tablier->longueur * $this->tablier->largeur; } public function __construct(protected string $name, protected Tablier $tablier) { $this->taille = fn() => $this->tablier->longueur * $this->tablier->largeur; } public function __clone(){ $this->tablier = clone $this->tablier; } } $pont1 = new Pont("towerBridge", new Tablier(386,16)); var_dump($pont1); $pont2 = clone $pont1; $chaine = serialise($pont1); echo $chaine; $pont3 = unserialise($chaine); var_dump($pont3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/krssZ
function name:  (null)
number of ops:  27
compiled vars:  !0 = $pont1, !1 = $pont2, !2 = $chaine, !3 = $pont3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $4      'Pont'
          1        SEND_VAL_EX                                              'towerBridge'
          2        NEW                                              $5      'Tablier'
          3        SEND_VAL_EX                                              386
          4        SEND_VAL_EX                                              16
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $5
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !0, $4
   31     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   32    12        CLONE                                            ~10     !0
         13        ASSIGN                                                   !1, ~10
   33    14        INIT_FCALL_BY_NAME                                       'serialise'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $12     
         17        ASSIGN                                                   !2, $12
   34    18        ECHO                                                     !2
   35    19        INIT_FCALL_BY_NAME                                       'unserialise'
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0  $14     
         22        ASSIGN                                                   !3, $14
   36    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FkrssZ%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/krssZ
function name:  {closure}
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'tablier'
          2        FETCH_OBJ_R                                      ~2      ~1, 'longueur'
          3        FETCH_THIS                                       $3      
          4        FETCH_OBJ_R                                      ~4      $3, 'tablier'
          5        FETCH_OBJ_R                                      ~5      ~4, 'largeur'
          6        MUL                                              ~6      ~2, ~5
          7      > RETURN                                                   ~6
          8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FkrssZ%3A17%240

Function %00%7Bclosure%7D%2Fin%2FkrssZ%3A21%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/krssZ
function name:  {closure}
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'tablier'
          2        FETCH_OBJ_R                                      ~2      ~1, 'longueur'
          3        FETCH_THIS                                       $3      
          4        FETCH_OBJ_R                                      ~4      $3, 'tablier'
          5        FETCH_OBJ_R                                      ~5      ~4, 'largeur'
          6        MUL                                              ~6      ~2, ~5
          7      > RETURN                                                   ~6
          8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FkrssZ%3A21%241

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

End of function __construct

End of class Tablier.

Class Pont:
Function __sleep:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/krssZ
function name:  __sleep
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   <array>
   14     1*     > RETURN                                                   null

End of function __sleep

Function __wakeup:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/krssZ
function name:  __wakeup
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FkrssZ%3A17%240'
          1        ASSIGN_OBJ                                               'taille'
          2        OP_DATA                                                  ~1
   18     3      > RETURN                                                   null

End of function __wakeup

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/krssZ
function name:  __construct
number of ops:  10
compiled vars:  !0 = $name, !1 = $tablier
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  !0
          4        ASSIGN_OBJ                                               'tablier'
          5        OP_DATA                                                  !1
   21     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FkrssZ%3A21%241'
          7        ASSIGN_OBJ                                               'taille'
          8        OP_DATA                                                  ~3
   22     9      > RETURN                                                   null

End of function __construct

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/krssZ
function name:  __clone
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~1      'tablier'
          1        CLONE                                            ~2      ~1
          2        ASSIGN_OBJ                                               'tablier'
          3        OP_DATA                                                  ~2
   26     4      > RETURN                                                   null

End of function __clone

End of class Pont.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.83 ms | 1396 KiB | 15 Q