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 = function(string $test, array $values): ?int { foreach ($values as $value) { if (strpos($value, $test)) { return sscanf($value, '%d/')[0]; } } return null; }; var_dump($getTransitos($bar, $foo));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uccaO
function name:  (null)
number of ops:  12
compiled vars:  !0 = $foo, !1 = $bar, !2 = $getTransitos
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                              ~5      [0]
          3        ASSIGN                                                       !2, ~5
   21     4        INIT_FCALL                                                   'var_dump'
          5        INIT_DYNAMIC_CALL                                            !2
          6        SEND_VAR_EX                                                  !1
          7        SEND_VAR_EX                                                  !0
          8        DO_FCALL                                          0  $7      
          9        SEND_VAR                                                     $7
         10        DO_ICALL                                                     
         11      > RETURN                                                       1


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

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.38 ms | 2017 KiB | 15 Q