3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); final readonly class Time { private function __construct( private int $seconds, ) {} public static function fromSeconds(int $seconds): self { return new self($seconds); } } // false var_dump(Time::fromSeconds(0) === Time::fromSeconds(0)); // true var_dump(Time::fromSeconds(0) == Time::fromSeconds(0)); var_dump(Time::fromSeconds(1) > Time::fromSeconds(0)); var_dump(Time::fromSeconds(1) >= Time::fromSeconds(1)); var_dump(Time::fromSeconds(0) < Time::fromSeconds(1)); var_dump(Time::fromSeconds(1) <= Time::fromSeconds(1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WhbBv
function name:  (null)
number of ops:  61
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
          2        SEND_VAL                                                 0
          3        DO_FCALL                                      0  $0      
          4        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
          5        SEND_VAL                                                 0
          6        DO_FCALL                                      0  $1      
          7        IS_IDENTICAL                                     ~2      $0, $1
          8        SEND_VAL                                                 ~2
          9        DO_ICALL                                                 
   22    10        INIT_FCALL                                               'var_dump'
         11        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         12        SEND_VAL                                                 0
         13        DO_FCALL                                      0  $4      
         14        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         15        SEND_VAL                                                 0
         16        DO_FCALL                                      0  $5      
         17        IS_EQUAL                                         ~6      $4, $5
         18        SEND_VAL                                                 ~6
         19        DO_ICALL                                                 
   23    20        INIT_FCALL                                               'var_dump'
         21        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         22        SEND_VAL                                                 1
         23        DO_FCALL                                      0  $8      
         24        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         25        SEND_VAL                                                 0
         26        DO_FCALL                                      0  $9      
         27        IS_SMALLER                                       ~10     $9, $8
         28        SEND_VAL                                                 ~10
         29        DO_ICALL                                                 
   24    30        INIT_FCALL                                               'var_dump'
         31        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         32        SEND_VAL                                                 1
         33        DO_FCALL                                      0  $12     
         34        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         35        SEND_VAL                                                 1
         36        DO_FCALL                                      0  $13     
         37        IS_SMALLER_OR_EQUAL                              ~14     $13, $12
         38        SEND_VAL                                                 ~14
         39        DO_ICALL                                                 
   25    40        INIT_FCALL                                               'var_dump'
         41        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         42        SEND_VAL                                                 0
         43        DO_FCALL                                      0  $16     
         44        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         45        SEND_VAL                                                 1
         46        DO_FCALL                                      0  $17     
         47        IS_SMALLER                                       ~18     $16, $17
         48        SEND_VAL                                                 ~18
         49        DO_ICALL                                                 
   26    50        INIT_FCALL                                               'var_dump'
         51        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         52        SEND_VAL                                                 1
         53        DO_FCALL                                      0  $20     
         54        INIT_STATIC_METHOD_CALL                                  'Time', 'fromSeconds'
         55        SEND_VAL                                                 1
         56        DO_FCALL                                      0  $21     
         57        IS_SMALLER_OR_EQUAL                              ~22     $20, $21
         58        SEND_VAL                                                 ~22
         59        DO_ICALL                                                 
         60      > RETURN                                                   1

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

End of function __construct

Function fromseconds:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WhbBv
function name:  fromSeconds
number of ops:  8
compiled vars:  !0 = $seconds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        NEW                          self                $1      
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   14     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function fromseconds

End of class Time.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.41 ms | 1437 KiB | 14 Q