3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cookie{ public $username; public $coffee; public $token; public function __toString() { return "<p> Hey ".$this->username."! </p><br>" . "<p> Here is your token for a free ". $this->coffee."!!</p><p>".$this->token."</p><p>Give us this token at your next visit!</p>"; } } class Token{ public $coffee; public $username; public function __construct($coffee, $username){ $this->coffee = (string)$coffee; $this->username = (string)$username; $this->crypto = "crc32"; } public function __toString(){ $x = $this->crypto; return substr(md5(rand($x($this->coffee . $this->username), 0xc0ffee)), 10); } } $a = new Token("a","b"); $a->crypto = "c"; var_dump(serialize($a));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ql9s
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'cookie'
   13     1        DECLARE_CLASS                                            'token'
   30     2        NEW                                              $1      'Token'
          3        SEND_VAL_EX                                              'a'
          4        SEND_VAL_EX                                              'b'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   31     7        ASSIGN_OBJ                                               !0, 'crypto'
          8        OP_DATA                                                  'c'
   32     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'serialize'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Class Cookie:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ql9s
function name:  __toString
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'username'
          1        CONCAT                                           ~1      '%3Cp%3E+Hey+', ~0
          2        CONCAT                                           ~2      ~1, '%21+%3C%2Fp%3E%3Cbr%3E'
   10     3        CONCAT                                           ~3      ~2, '%3Cp%3E+Here+is+your+token+for+a+free+'
          4        FETCH_OBJ_R                                      ~4      'coffee'
          5        CONCAT                                           ~5      ~3, ~4
          6        CONCAT                                           ~6      ~5, '%21%21%3C%2Fp%3E%3Cp%3E'
          7        FETCH_OBJ_R                                      ~7      'token'
          8        CONCAT                                           ~8      ~6, ~7
          9        CONCAT                                           ~9      ~8, '%3C%2Fp%3E%3Cp%3EGive+us+this+token+at+your+next+visit%21%3C%2Fp%3E'
         10        VERIFY_RETURN_TYPE                                       ~9
         11      > RETURN                                                   ~9
   11    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function __tostring

End of class Cookie.

Class Token:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ql9s
function name:  __construct
number of ops:  11
compiled vars:  !0 = $coffee, !1 = $username
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        CAST                                          6  ~3      !0
          3        ASSIGN_OBJ                                               'coffee'
          4        OP_DATA                                                  ~3
   20     5        CAST                                          6  ~5      !1
          6        ASSIGN_OBJ                                               'username'
          7        OP_DATA                                                  ~5
   21     8        ASSIGN_OBJ                                               'crypto'
          9        OP_DATA                                                  'crc32'
   22    10      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ql9s
function name:  __toString
number of ops:  23
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~1      'crypto'
          1        ASSIGN                                                   !0, ~1
   26     2        INIT_FCALL                                               'substr'
          3        INIT_FCALL                                               'md5'
          4        INIT_FCALL                                               'rand'
          5        INIT_DYNAMIC_CALL                                        !0
          6        FETCH_OBJ_R                                      ~3      'coffee'
          7        FETCH_OBJ_R                                      ~4      'username'
          8        CONCAT                                           ~5      ~3, ~4
          9        SEND_VAL_EX                                              ~5
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        SEND_VAL                                                 12648430
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        SEND_VAL                                                 10
         18        DO_ICALL                                         $9      
         19        VERIFY_RETURN_TYPE                                       $9
         20      > RETURN                                                   $9
   27    21*       VERIFY_RETURN_TYPE                                       
         22*     > RETURN                                                   null

End of function __tostring

End of class Token.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.75 ms | 1400 KiB | 23 Q