3v4l.org

run code in 300+ PHP versions simultaneously
<?php const PERMANENT = -1; function mergeMaxAges() { $max_ages = func_get_args(); // Filter out all max-age values set to cache permanently. $max_ages = array_filter($max_ages, function ($max_age) { return $max_age !== PERMANENT; }); // If nothing is left, then all max-age values were set to cache // permanently, and then that is the result. if (empty($max_ages)) { return PERMANENT; } return min($max_ages); } for ($i = 0; $i < 10000; $i++) { mergeMaxAges(0, 60); mergeMaxAges(0, 0); mergeMaxAges(0, PERMANENT); mergeMaxAges(PERMANENT, 60); mergeMaxAges(PERMANENT, PERMANENT); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 3
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 3
Branch analysis from position: 30
Branch analysis from position: 3
filename:       /in/0ptco
function name:  (null)
number of ops:  31
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CONST                                            'PERMANENT', -1
   19     1        ASSIGN                                                   !0, 0
          2      > JMP                                                      ->28
   20     3    >   INIT_FCALL                                               'mergemaxages'
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 60
          6        DO_FCALL                                      0          
   21     7        INIT_FCALL                                               'mergemaxages'
          8        SEND_VAL                                                 0
          9        SEND_VAL                                                 0
         10        DO_FCALL                                      0          
   22    11        INIT_FCALL                                               'mergemaxages'
         12        SEND_VAL                                                 0
         13        FETCH_CONSTANT                                   ~4      'PERMANENT'
         14        SEND_VAL                                                 ~4
         15        DO_FCALL                                      0          
   23    16        INIT_FCALL                                               'mergemaxages'
         17        FETCH_CONSTANT                                   ~6      'PERMANENT'
         18        SEND_VAL                                                 ~6
         19        SEND_VAL                                                 60
         20        DO_FCALL                                      0          
   24    21        INIT_FCALL                                               'mergemaxages'
         22        FETCH_CONSTANT                                   ~8      'PERMANENT'
         23        SEND_VAL                                                 ~8
         24        FETCH_CONSTANT                                   ~9      'PERMANENT'
         25        SEND_VAL                                                 ~9
         26        DO_FCALL                                      0          
   19    27        PRE_INC                                                  !0
         28    >   IS_SMALLER                                               !0, 10000
         29      > JMPNZ                                                    ~12, ->3
   25    30    > > RETURN                                                   1

Function mergemaxages:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ptco
function name:  mergeMaxAges
number of ops:  17
compiled vars:  !0 = $max_ages
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FUNC_GET_ARGS                                    ~1      
          1        ASSIGN                                                   !0, ~1
    7     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0ptco%3A7%240'
    9     5        SEND_VAL                                                 ~3
          6        DO_ICALL                                         $4      
    7     7        ASSIGN                                                   !0, $4
   13     8        ISSET_ISEMPTY_CV                                         !0
          9      > JMPZ                                                     ~6, ->12
   14    10    >   FETCH_CONSTANT                                   ~7      'PERMANENT'
         11      > RETURN                                                   ~7
   17    12    >   INIT_FCALL                                               'min'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15      > RETURN                                                   $8
   18    16*     > RETURN                                                   null

End of function mergemaxages

Function %00%7Bclosure%7D%2Fin%2F0ptco%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ptco
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $max_age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_CONSTANT                                   ~1      'PERMANENT'
          2        IS_NOT_IDENTICAL                                 ~2      !0, ~1
          3      > RETURN                                                   ~2
    9     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F0ptco%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.82 ms | 950 KiB | 23 Q