3v4l.org

run code in 500+ PHP versions simultaneously
<?php $foo = [ '50/2021-10-31@2', '93/2021-11-14@2', '300/2022-02-14@2', ]; $bar = '2021-11-14'; $getTransitos = fn($test, $values): ?int => array_reduce( $values, fn($found, $value): ?int => $found ?? ( strpos($value, $test) ? sscanf($value, '%d/')[0] : null ), null ); var_dump($getTransitos($bar, $foo));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hrr7F
function name:  (null)
number of ops:  14
compiled vars:  !0 = $foo, !1 = $bar, !2 = $getTransitos, !3 = $found, !4 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    9     1        ASSIGN                                                       !1, '2021-11-14'
   11     2        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
          3        BIND_LEXICAL                                                 ~7, !3
          4        BIND_LEXICAL                                                 ~7, !4
          5        ASSIGN                                                       !2, ~7
   19     6        INIT_FCALL                                                   'var_dump'
          7        INIT_DYNAMIC_CALL                                            !2
          8        SEND_VAR_EX                                                  !1
          9        SEND_VAR_EX                                                  !0
         10        DO_FCALL                                          0  $9      
         11        SEND_VAR                                                     $9
         12        DO_ICALL                                                     
         13      > 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/hrr7F
function name:  {closure:/in/hrr7F:11}
number of ops:  15
compiled vars:  !0 = $test, !1 = $values, !2 = $found, !3 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        BIND_STATIC                                                  !3
          4        INIT_FCALL                                                   'array_reduce'
   12     5        SEND_VAR                                                     !1
   13     6        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          7        BIND_LEXICAL                                                 ~4, !0
   15     8        SEND_VAL                                                     ~4
   16     9        SEND_VAL                                                     null
   11    10        DO_ICALL                                             $5      
   16    11        VERIFY_RETURN_TYPE                                           $5
         12      > RETURN                                                       $5
   17    13*       VERIFY_RETURN_TYPE                                           
         14*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hrr7F
function name:  {closure:{closure:/in/hrr7F:11}:13}
number of ops:  19
compiled vars:  !0 = $found, !1 = $value, !2 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        COALESCE                                             ~3      !0
   14     4        FRAMELESS_ICALL_2                strpos              ~4      !1, !2
          5      > JMPZ                                                         ~4, ->13
          6    >   INIT_FCALL                                                   'sscanf'
          7        SEND_VAR                                                     !1
          8        SEND_VAL                                                     '%25d%2F'
          9        DO_ICALL                                             $5      
         10        FETCH_DIM_R                                          ~6      $5, 0
         11        QM_ASSIGN                                            ~7      ~6
         12      > JMP                                                          ->14
         13    >   QM_ASSIGN                                            ~7      null
         14    >   QM_ASSIGN                                            ~3      ~7
         15        VERIFY_RETURN_TYPE                                           ~3
         16      > RETURN                                                       ~3
   15    17*       VERIFY_RETURN_TYPE                                           
         18*     > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.15 ms | 2025 KiB | 16 Q