3v4l.org

run code in 300+ PHP versions simultaneously
<?php $objects = [ (object)['cats' => 2], (object)['dogs' => 2], (object)['fish' => 10], (object)['birds' => 1], ]; $needleField = 'cats'; $needleValue = 2; var_export( array_any( $objects, fn($obj) => property_exists($obj, $needleField) && $obj->$needleField === $needleValue ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eYOuI
function name:  (null)
number of ops:  22
compiled vars:  !0 = $objects, !1 = $needleField, !2 = $needleValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~3      <array>
          1        INIT_ARRAY                                       ~4      ~3
    5     2        CAST                                          8  ~5      <array>
          3        ADD_ARRAY_ELEMENT                                ~4      ~5
    6     4        CAST                                          8  ~6      <array>
          5        ADD_ARRAY_ELEMENT                                ~4      ~6
    7     6        CAST                                          8  ~7      <array>
          7        ADD_ARRAY_ELEMENT                                ~4      ~7
    3     8        ASSIGN                                                   !0, ~4
   10     9        ASSIGN                                                   !1, 'cats'
   11    10        ASSIGN                                                   !2, 2
   13    11        INIT_FCALL                                               'var_export'
   14    12        INIT_FCALL_BY_NAME                                       'array_any'
   15    13        SEND_VAR_EX                                              !0
   16    14        DECLARE_LAMBDA_FUNCTION                          ~11     [0]
         15        BIND_LEXICAL                                             ~11, !1
         16        BIND_LEXICAL                                             ~11, !2
   17    17        SEND_VAL_EX                                              ~11
   14    18        DO_FCALL                                      0  $12     
   17    19        SEND_VAR                                                 $12
   13    20        DO_ICALL                                                 
   18    21      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/eYOuI
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $obj, !1 = $needleField, !2 = $needleValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        INIT_FCALL                                               'property_exists'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7      > JMPZ_EX                                          ~4      $3, ->11
          8    >   FETCH_OBJ_R                                      ~5      !0, !1
          9        IS_IDENTICAL                                     ~6      !2, ~5
         10        BOOL                                             ~4      ~6
         11    > > RETURN                                                   ~4
   17    12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.81 ms | 1012 KiB | 15 Q