3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CommandId { private $name; private $timestamp; public function __construct($name) { $this->name = (string) $name; $this->timestamp = microtime(); } public static function fromString($anId) { $parts = explode('_', $anId); $id = new static($parts[0]); $id->timestamp = (int) $parts[1]; return $id; } public function name() { return $this->name; } public function timestamp() { return $this->timestamp; } public function __toString() { return "{$this->name}_{$this->timestamp}"; } } echo CommandId::fromString('Foo_' . microtime());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UD83m
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'commandid'
   39     1        INIT_STATIC_METHOD_CALL                                  'CommandId', 'fromString'
          2        INIT_FCALL                                               'microtime'
          3        DO_ICALL                                         $0      
          4        CONCAT                                           ~1      'Foo_', $0
          5        SEND_VAL_EX                                              ~1
          6        DO_FCALL                                      0  $2      
          7        ECHO                                                     $2
          8      > RETURN                                                   1

Class CommandId:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UD83m
function name:  __construct
number of ops:  9
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  ~2
   11     4        INIT_FCALL                                               'microtime'
          5        DO_ICALL                                         $4      
          6        ASSIGN_OBJ                                               'timestamp'
          7        OP_DATA                                                  $4
   12     8      > RETURN                                                   null

End of function __construct

Function fromstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UD83m
function name:  fromString
number of ops:  18
compiled vars:  !0 = $anId, !1 = $parts, !2 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '_'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   17     6        NEW                          static              $5      
          7        CHECK_FUNC_ARG                                           
          8        FETCH_DIM_FUNC_ARG                               $6      !1, 0
          9        SEND_FUNC_ARG                                            $6
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $5
   18    12        FETCH_DIM_R                                      ~10     !1, 1
         13        CAST                                          4  ~11     ~10
         14        ASSIGN_OBJ                                               !2, 'timestamp'
         15        OP_DATA                                                  ~11
   20    16      > RETURN                                                   !2
   21    17*     > RETURN                                                   null

End of function fromstring

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

End of function name

Function timestamp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UD83m
function name:  timestamp
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   FETCH_OBJ_R                                      ~0      'timestamp'
          1      > RETURN                                                   ~0
   31     2*     > RETURN                                                   null

End of function timestamp

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UD83m
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        ROPE_INIT                                     3  ~3      ~0
          2        ROPE_ADD                                      1  ~3      ~3, '_'
          3        FETCH_OBJ_R                                      ~1      'timestamp'
          4        ROPE_END                                      2  ~2      ~3, ~1
          5        VERIFY_RETURN_TYPE                                       ~2
          6      > RETURN                                                   ~2
   36     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function __tostring

End of class CommandId.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.68 ms | 1400 KiB | 17 Q