3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*{ "_id" : ObjectId("595baefce2810a6a8a94fe2d"), "user" : "1234abc", "type" : "session-started", "name" : "moja o sesja", "reference_id" : "hippo-123", "created_on" : ISODate("2017-01-01T01:01:01.123Z") }*/ class A { private static $_id = 0x10a6a8a94fe2d; private $user; private $type; private $reference_id; private $created_on; public function __construct($user, $type, $reference_id, $created_on) { $this->user = $user; $this->type = $type; $this->reference_id = $reference_id; $this->created_on = $created_on; } public function __toString() { return sprintf('{ "_id": ObjectId("595baefce28%x"), "user": "%s", "type": "%s", "name": "my %s", "reference_id": "hippo-%s", "created_on": ISODate("%s.000Z") }', ++self::$_id, $this->user, $this->type, $this->type, $this->reference_id, $this->created_on ); } } echo new A('u1', 'session_started', 11, '2017-01-01T01:01:01');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8kO9T
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'a'
   48     1        NEW                                              $0      'A'
          2        SEND_VAL_EX                                              'u1'
          3        SEND_VAL_EX                                              'session_started'
          4        SEND_VAL_EX                                              11
          5        SEND_VAL_EX                                              '2017-01-01T01%3A01%3A01'
          6        DO_FCALL                                      0          
          7        ECHO                                                     $0
          8      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8kO9T
function name:  __construct
number of ops:  13
compiled vars:  !0 = $user, !1 = $type, !2 = $reference_id, !3 = $created_on
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   21     4        ASSIGN_OBJ                                               'user'
          5        OP_DATA                                                  !0
   22     6        ASSIGN_OBJ                                               'type'
          7        OP_DATA                                                  !1
   23     8        ASSIGN_OBJ                                               'reference_id'
          9        OP_DATA                                                  !2
   24    10        ASSIGN_OBJ                                               'created_on'
         11        OP_DATA                                                  !3
   25    12      > 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/8kO9T
function name:  __toString
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'sprintf'
          1        SEND_VAL                                                 '%7B%0A++++++++++++%22_id%22%3A+ObjectId%28%22595baefce28%25x%22%29%2C%0A++++++++++++%22user%22%3A+%22%25s%22%2C%0A++++++++++++%22type%22%3A+%22%25s%22%2C%0A++++++++++++%22name%22%3A+%22my+%25s%22%2C%0A++++++++++++%22reference_id%22%3A+%22hippo-%25s%22%2C%0A++++++++++++%22created_on%22%3A+ISODate%28%22%25s.000Z%22%29%0A++++++++%7D'
   37     2        PRE_INC_STATIC_PROP                              ~0      '_id'
          3        SEND_VAL                                                 ~0
   38     4        FETCH_OBJ_R                                      ~1      'user'
          5        SEND_VAL                                                 ~1
   39     6        FETCH_OBJ_R                                      ~2      'type'
          7        SEND_VAL                                                 ~2
   40     8        FETCH_OBJ_R                                      ~3      'type'
          9        SEND_VAL                                                 ~3
   41    10        FETCH_OBJ_R                                      ~4      'reference_id'
         11        SEND_VAL                                                 ~4
   42    12        FETCH_OBJ_R                                      ~5      'created_on'
         13        SEND_VAL                                                 ~5
         14        DO_ICALL                                         $6      
         15        VERIFY_RETURN_TYPE                                       $6
         16      > RETURN                                                   $6
   44    17*       VERIFY_RETURN_TYPE                                       
         18*     > RETURN                                                   null

End of function __tostring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.21 ms | 1400 KiB | 15 Q