3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $array = ['A', 'AA', 'AAA']; $arrayWithKeys = ['A' => 1, 'AA' => 2, 'AAA' => 3]; echo "array_find examples" . PHP_EOL; var_dump(array_find($array, static fn(string $value): bool => strlen($value) > 2)); // returns AAA var_dump(array_find($array, static fn(string $value): bool => strlen($value) > 3)); // returns null var_dump(array_find($arrayWithKeys, static fn(int $value, string $key): bool => $value === strlen($key))); // returns 1 echo PHP_EOL . "array_find_key examples" . PHP_EOL; var_dump(array_find_key($array, static fn(string $value): bool => strlen($value) > 2)); // returns 2 var_dump(array_find_key($array, static fn(string $value): bool => strlen($value) > 3)); // returns null var_dump(array_find_key($arrayWithKeys, static fn(int $value, string $key): bool => $value === strlen($key))); // returns A echo PHP_EOL . "array_any examples" . PHP_EOL; var_dump(array_any($array, static fn(string $value): bool => strlen($value) > 2)); // returns true var_dump(array_any($arrayWithKeys, static fn(int $value, string $key): bool => $value === strlen($key))); // returns true echo PHP_EOL . "array_all examples" . PHP_EOL; var_dump(array_all($array, static fn(string $value): bool => strlen($value) < 4)); // returns true var_dump(array_all($arrayWithKeys, static fn(int $value, string $key): bool => $value === strlen($key))); // returns true
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  (null)
number of ops:  87
compiled vars:  !0 = $array, !1 = $arrayWithKeys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, <array>
    8     2        ECHO                                                     'array_find+examples%0A'
    9     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL_BY_NAME                                       'array_find'
          5        SEND_VAR_EX                                              !0
          6        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          7        SEND_VAL_EX                                              ~4
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL_BY_NAME                                       'array_find'
         13        SEND_VAR_EX                                              !0
         14        DECLARE_LAMBDA_FUNCTION                          ~7      [1]
         15        SEND_VAL_EX                                              ~7
         16        DO_FCALL                                      0  $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
   11    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL_BY_NAME                                       'array_find'
         21        SEND_VAR_EX                                              !1
         22        DECLARE_LAMBDA_FUNCTION                          ~10     [2]
         23        SEND_VAL_EX                                              ~10
         24        DO_FCALL                                      0  $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                                 
   13    27        ECHO                                                     '%0Aarray_find_key+examples%0A'
   14    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL_BY_NAME                                       'array_find_key'
         30        SEND_VAR_EX                                              !0
         31        DECLARE_LAMBDA_FUNCTION                          ~13     [3]
         32        SEND_VAL_EX                                              ~13
         33        DO_FCALL                                      0  $14     
         34        SEND_VAR                                                 $14
         35        DO_ICALL                                                 
   15    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL_BY_NAME                                       'array_find_key'
         38        SEND_VAR_EX                                              !0
         39        DECLARE_LAMBDA_FUNCTION                          ~16     [4]
         40        SEND_VAL_EX                                              ~16
         41        DO_FCALL                                      0  $17     
         42        SEND_VAR                                                 $17
         43        DO_ICALL                                                 
   16    44        INIT_FCALL                                               'var_dump'
         45        INIT_FCALL_BY_NAME                                       'array_find_key'
         46        SEND_VAR_EX                                              !1
         47        DECLARE_LAMBDA_FUNCTION                          ~19     [5]
         48        SEND_VAL_EX                                              ~19
         49        DO_FCALL                                      0  $20     
         50        SEND_VAR                                                 $20
         51        DO_ICALL                                                 
   18    52        ECHO                                                     '%0Aarray_any+examples%0A'
   19    53        INIT_FCALL                                               'var_dump'
         54        INIT_FCALL_BY_NAME                                       'array_any'
         55        SEND_VAR_EX                                              !0
         56        DECLARE_LAMBDA_FUNCTION                          ~22     [6]
         57        SEND_VAL_EX                                              ~22
         58        DO_FCALL                                      0  $23     
         59        SEND_VAR                                                 $23
         60        DO_ICALL                                                 
   20    61        INIT_FCALL                                               'var_dump'
         62        INIT_FCALL_BY_NAME                                       'array_any'
         63        SEND_VAR_EX                                              !1
         64        DECLARE_LAMBDA_FUNCTION                          ~25     [7]
         65        SEND_VAL_EX                                              ~25
         66        DO_FCALL                                      0  $26     
         67        SEND_VAR                                                 $26
         68        DO_ICALL                                                 
   21    69        ECHO                                                     '%0Aarray_all+examples%0A'
   22    70        INIT_FCALL                                               'var_dump'
         71        INIT_FCALL_BY_NAME                                       'array_all'
         72        SEND_VAR_EX                                              !0
         73        DECLARE_LAMBDA_FUNCTION                          ~28     [8]
         74        SEND_VAL_EX                                              ~28
         75        DO_FCALL                                      0  $29     
         76        SEND_VAR                                                 $29
         77        DO_ICALL                                                 
   23    78        INIT_FCALL                                               'var_dump'
         79        INIT_FCALL_BY_NAME                                       'array_all'
         80        SEND_VAR_EX                                              !1
         81        DECLARE_LAMBDA_FUNCTION                          ~31     [9]
         82        SEND_VAL_EX                                              ~31
         83        DO_FCALL                                      0  $32     
         84        SEND_VAR                                                 $32
         85        DO_ICALL                                                 
         86      > 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/8MNU0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                       ~2      2, ~1
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
          5*       VERIFY_RETURN_TYPE                                       
          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/8MNU0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                       ~2      3, ~1
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
          5*       VERIFY_RETURN_TYPE                                       
          6*     > 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/8MNU0
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        STRLEN                                           ~2      !1
          3        IS_IDENTICAL                                     ~3      !0, ~2
          4        VERIFY_RETURN_TYPE                                       ~3
          5      > RETURN                                                   ~3
          6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of Dynamic Function 2

Dynamic Function 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                       ~2      2, ~1
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
          5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of Dynamic Function 3

Dynamic Function 4
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                       ~2      3, ~1
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
          5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of Dynamic Function 4

Dynamic Function 5
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        STRLEN                                           ~2      !1
          3        IS_IDENTICAL                                     ~3      !0, ~2
          4        VERIFY_RETURN_TYPE                                       ~3
          5      > RETURN                                                   ~3
          6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of Dynamic Function 5

Dynamic Function 6
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                       ~2      2, ~1
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
          5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of Dynamic Function 6

Dynamic Function 7
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        STRLEN                                           ~2      !1
          3        IS_IDENTICAL                                     ~3      !0, ~2
          4        VERIFY_RETURN_TYPE                                       ~3
          5      > RETURN                                                   ~3
          6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of Dynamic Function 7

Dynamic Function 8
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                       ~2      ~1, 4
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
          5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of Dynamic Function 8

Dynamic Function 9
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8MNU0
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        STRLEN                                           ~2      !1
          3        IS_IDENTICAL                                     ~3      !0, ~2
          4        VERIFY_RETURN_TYPE                                       ~3
          5      > RETURN                                                   ~3
          6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of Dynamic Function 9

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.64 ms | 1468 KiB | 14 Q