3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('array_find')) { function array_find(array $array, callable $callback): mixed { foreach ($array as $key => $value) { if ($callback($value, $key)) { return $value; } } return null; } } $fortuneArray = [ '1' => '80 | 96 | 1000', '2' => '3648|4000|100' ]; $valueToBeCompared = ['88']; $found = array_find( $fortuneArray, fn($dataset) => sscanf($dataset, '%d | %d', $min, $max) === 2 && $min < $valueToBeCompared[0] && $valueToBeCompared[0] < $max ); var_export( $found !== null ? sscanf($found, '%*d | %*d | %d')[0] : null );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/4aJ65
function name:  (null)
number of ops:  31
compiled vars:  !0 = $fortuneArray, !1 = $valueToBeCompared, !2 = $found, !3 = $min, !4 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'array_find'
          2        DO_ICALL                                         $5      
          3        BOOL_NOT                                         ~6      $5
          4      > JMPZ                                                     ~6, ->6
    4     5    >   DECLARE_FUNCTION                                         'array_find'
   15     6    >   ASSIGN                                                   !0, <array>
   19     7        ASSIGN                                                   !1, <array>
   21     8        INIT_FCALL_BY_NAME                                       'array_find'
   22     9        SEND_VAR_EX                                              !0
   23    10        DECLARE_LAMBDA_FUNCTION                          ~9      [1]
         11        BIND_LEXICAL                                             ~9, !3
         12        BIND_LEXICAL                                             ~9, !4
         13        BIND_LEXICAL                                             ~9, !1
   26    14        SEND_VAL_EX                                              ~9
   21    15        DO_FCALL                                      0  $10     
         16        ASSIGN                                                   !2, $10
   27    17        INIT_FCALL                                               'var_export'
   28    18        TYPE_CHECK                                  1020          !2
         19      > JMPZ                                                     ~12, ->27
   29    20    >   INIT_FCALL                                               'sscanf'
         21        SEND_VAR                                                 !2
         22        SEND_VAL                                                 '%25%2Ad+%7C+%25%2Ad+%7C+%25d'
         23        DO_ICALL                                         $13     
         24        FETCH_DIM_R                                      ~14     $13, 0
         25        QM_ASSIGN                                        ~15     ~14
         26      > JMP                                                      ->28
   30    27    >   QM_ASSIGN                                        ~15     null
         28    >   SEND_VAL                                                 ~15
   27    29        DO_ICALL                                                 
   31    30      > 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 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
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 = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/4aJ65
function name:  array_find
number of ops:  17
compiled vars:  !0 = $array, !1 = $callback, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2      > FE_RESET_R                                       $4      !0, ->13
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->13
          4    >   ASSIGN                                                   !3, ~5
    6     5        INIT_DYNAMIC_CALL                                        !1
          6        SEND_VAR_EX                                              !2
          7        SEND_VAR_EX                                              !3
          8        DO_FCALL                                      0  $7      
          9      > JMPZ                                                     $7, ->12
    7    10    >   FE_FREE                                                  $4
         11      > RETURN                                                   !2
    5    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $4
   11    14      > RETURN                                                   null
   12    15*       VERIFY_RETURN_TYPE                                       
         16*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 15
filename:       /in/4aJ65
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $dataset, !1 = $min, !2 = $max, !3 = $valueToBeCompared
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
          4        INIT_FCALL                                               'sscanf'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '%25d+%7C+%25d'
          7        SEND_REF                                                 !1
          8        SEND_REF                                                 !2
          9        DO_ICALL                                         $4      
         10        IS_IDENTICAL                                     ~5      $4, 2
         11      > JMPZ_EX                                          ~5      ~5, ->15
   24    12    >   FETCH_DIM_R                                      ~6      !3, 0
         13        IS_SMALLER                                       ~7      !1, ~6
         14        BOOL                                             ~5      ~7
         15    > > JMPZ_EX                                          ~5      ~5, ->19
   25    16    >   FETCH_DIM_R                                      ~8      !3, 0
         17        IS_SMALLER                                       ~9      ~8, !2
         18        BOOL                                             ~5      ~9
         19    > > RETURN                                                   ~5
   26    20*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.97 ms | 1009 KiB | 16 Q