3v4l.org

run code in 300+ PHP versions simultaneously
<?php function measure_duration(callable $callback) { $start = microtime(true); call_user_func($callback); $duration = microtime(true) - $start; printf("Duration: %s\n\n", number_format($duration, 6)); } $timezone = new DateTimeZone('Europe/Berlin'); measure_duration(function() use($timezone) { printf("Default Value\n"); $timezone->getTransitions(); }); measure_duration(function() use($timezone) { $timestamp = 0; printf("Timestamp for %s\n", date('Y-m-d H:i:s', $timestamp)); $timezone->getTransitions($timestamp); }); measure_duration(function() use($timezone) { $timestamp = -62135596800; printf("Timestamp for %s\n", date('Y-m-d H:i:s', $timestamp)); $timezone->getTransitions($timestamp); });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MhkR8
function name:  (null)
number of ops:  20
compiled vars:  !0 = $timezone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'DateTimeZone'
          1        SEND_VAL_EX                                              'Europe%2FBerlin'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   12     4        INIT_FCALL                                               'measure_duration'
          5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          6        BIND_LEXICAL                                             ~4, !0
   15     7        SEND_VAL                                                 ~4
   12     8        DO_FCALL                                      0          
   17     9        INIT_FCALL                                               'measure_duration'
         10        DECLARE_LAMBDA_FUNCTION                          ~6      [1]
         11        BIND_LEXICAL                                             ~6, !0
   21    12        SEND_VAL                                                 ~6
   17    13        DO_FCALL                                      0          
   23    14        INIT_FCALL                                               'measure_duration'
         15        DECLARE_LAMBDA_FUNCTION                          ~8      [2]
         16        BIND_LEXICAL                                             ~8, !0
   27    17        SEND_VAL                                                 ~8
   23    18        DO_FCALL                                      0          
   27    19      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MhkR8
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $timezone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   BIND_STATIC                                              !0
   13     1        INIT_FCALL                                               'printf'
          2        SEND_VAL                                                 'Default+Value%0A'
          3        DO_ICALL                                                 
   14     4        INIT_METHOD_CALL                                         !0, 'getTransitions'
          5        DO_FCALL                                      0          
   15     6      > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MhkR8
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $timezone, !1 = $timestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   BIND_STATIC                                              !0
   18     1        ASSIGN                                                   !1, 0
   19     2        INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 'Timestamp+for+%25s%0A'
          4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
   20    10        INIT_METHOD_CALL                                         !0, 'getTransitions'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
   21    13      > RETURN                                                   null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MhkR8
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $timezone, !1 = $timestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   BIND_STATIC                                              !0
   24     1        ASSIGN                                                   !1, -62135596800
   25     2        INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 'Timestamp+for+%25s%0A'
          4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
   26    10        INIT_METHOD_CALL                                         !0, 'getTransitions'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
   27    13      > RETURN                                                   null

End of Dynamic Function 2

Function measure_duration:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MhkR8
function name:  measure_duration
number of ops:  21
compiled vars:  !0 = $callback, !1 = $start, !2 = $duration
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    5     5        INIT_USER_CALL                                0          'call_user_func', !0
          6        DO_FCALL                                      0          
    6     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $6      
         10        SUB                                              ~7      $6, !1
         11        ASSIGN                                                   !2, ~7
    7    12        INIT_FCALL                                               'printf'
         13        SEND_VAL                                                 'Duration%3A+%25s%0A%0A'
         14        INIT_FCALL                                               'number_format'
         15        SEND_VAR                                                 !2
         16        SEND_VAL                                                 6
         17        DO_ICALL                                         $9      
         18        SEND_VAR                                                 $9
         19        DO_ICALL                                                 
    8    20      > RETURN                                                   null

End of function measure_duration

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.29 ms | 1012 KiB | 20 Q