3v4l.org

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

Class CommandId:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qNOdQ
function name:  __construct
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN_OBJ                                               'name'
          5        OP_DATA                                                  $2
   10     6        INIT_FCALL                                               'microtime'
          7        DO_ICALL                                         $4      
          8        ASSIGN_OBJ                                               'time'
          9        OP_DATA                                                  $4
   11    10      > 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/qNOdQ
function name:  fromString
number of ops:  21
compiled vars:  !0 = $idString, !1 = $parts, !2 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '_'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   15     6        NEW                          static              $5      
          7        INIT_FCALL                                               'array_shift'
          8        SEND_REF                                                 !1
          9        DO_ICALL                                         $6      
         10        SEND_VAR_NO_REF_EX                                       $6
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $5
   16    13        INIT_FCALL                                               'array_pop'
         14        SEND_REF                                                 !1
         15        DO_ICALL                                         $10     
         16        CAST                                          4  ~11     $10
         17        ASSIGN_OBJ                                               !2, 'time'
         18        OP_DATA                                                  ~11
   17    19      > RETURN                                                   !2
   18    20*     > 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/qNOdQ
function name:  name
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1      > RETURN                                                   ~0
   22     2*     > RETURN                                                   null

End of function name

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

End of function time

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qNOdQ
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        ROPE_INIT                                     3  ~3      ~0
          2        ROPE_ADD                                      1  ~3      ~3, '_'
          3        FETCH_OBJ_R                                      ~1      'time'
          4        ROPE_END                                      2  ~2      ~3, ~1
          5        VERIFY_RETURN_TYPE                                       ~2
          6      > RETURN                                                   ~2
   30     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:
158.63 ms | 1400 KiB | 27 Q