3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stock = ["7", "5", "3"]; $request = ["3", "6", "3"]; echo "Are there any items with insufficient stock: "; var_export( array_any( $stock, fn($v, $i) => $v < $request[$i] ) ); echo "\n---\nDo all items have sufficient stock: "; var_export( array_all( $stock, fn($v, $i) => $v >= $request[$i] ) ); echo "\n---\nWhich stock item value is insufficient: "; // more helpful if $v was a row from a 2d array var_export( array_find( $stock, fn($v, $i) => $v < $request[$i] ) ); echo "\n---\nWhich stock indexes have an insufficient amount: "; var_export( array_find_key( $stock, fn($v, $i) => $v < $request[$i] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DBpAE
function name:  (null)
number of ops:  43
compiled vars:  !0 = $stock, !1 = $request
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ECHO                                                     'Are+there+any+items+with+insufficient+stock%3A+'
    7     3        INIT_FCALL                                               'var_export'
    8     4        INIT_FCALL_BY_NAME                                       'array_any'
    9     5        SEND_VAR_EX                                              !0
   10     6        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          7        BIND_LEXICAL                                             ~4, !1
   11     8        SEND_VAL_EX                                              ~4
    8     9        DO_FCALL                                      0  $5      
   11    10        SEND_VAR                                                 $5
    7    11        DO_ICALL                                                 
   14    12        ECHO                                                     '%0A---%0ADo+all+items+have+sufficient+stock%3A+'
   15    13        INIT_FCALL                                               'var_export'
   16    14        INIT_FCALL_BY_NAME                                       'array_all'
   17    15        SEND_VAR_EX                                              !0
   18    16        DECLARE_LAMBDA_FUNCTION                          ~7      [1]
         17        BIND_LEXICAL                                             ~7, !1
   19    18        SEND_VAL_EX                                              ~7
   16    19        DO_FCALL                                      0  $8      
   19    20        SEND_VAR                                                 $8
   15    21        DO_ICALL                                                 
   22    22        ECHO                                                     '%0A---%0AWhich+stock+item+value+is+insufficient%3A+'
   24    23        INIT_FCALL                                               'var_export'
   25    24        INIT_FCALL_BY_NAME                                       'array_find'
   26    25        SEND_VAR_EX                                              !0
   27    26        DECLARE_LAMBDA_FUNCTION                          ~10     [2]
         27        BIND_LEXICAL                                             ~10, !1
   28    28        SEND_VAL_EX                                              ~10
   25    29        DO_FCALL                                      0  $11     
   28    30        SEND_VAR                                                 $11
   24    31        DO_ICALL                                                 
   31    32        ECHO                                                     '%0A---%0AWhich+stock+indexes+have+an+insufficient+amount%3A+'
   32    33        INIT_FCALL                                               'var_export'
   33    34        INIT_FCALL_BY_NAME                                       'array_find_key'
   34    35        SEND_VAR_EX                                              !0
   35    36        DECLARE_LAMBDA_FUNCTION                          ~13     [3]
         37        BIND_LEXICAL                                             ~13, !1
   36    38        SEND_VAL_EX                                              ~13
   33    39        DO_FCALL                                      0  $14     
   36    40        SEND_VAR                                                 $14
   32    41        DO_ICALL                                                 
   37    42      > 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/DBpAE
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $i, !2 = $request
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        FETCH_DIM_R                                      ~3      !2, !1
          4        IS_SMALLER                                       ~4      !0, ~3
          5      > RETURN                                                   ~4
   11     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/DBpAE
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $i, !2 = $request
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        FETCH_DIM_R                                      ~3      !2, !1
          4        IS_SMALLER_OR_EQUAL                              ~4      ~3, !0
          5      > RETURN                                                   ~4
   19     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/DBpAE
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $i, !2 = $request
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        FETCH_DIM_R                                      ~3      !2, !1
          4        IS_SMALLER                                       ~4      !0, ~3
          5      > RETURN                                                   ~4
   28     6*     > 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/DBpAE
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v, !1 = $i, !2 = $request
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        FETCH_DIM_R                                      ~3      !2, !1
          4        IS_SMALLER                                       ~4      !0, ~3
          5      > RETURN                                                   ~4
   36     6*     > RETURN                                                   null

End of Dynamic Function 3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.01 ms | 1007 KiB | 14 Q