3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input= [ 'football GAME', 'cricket GAME', 'computer DEVICE', 'mobile DEVICE' ]; $needle = 'DEVICE'; $output = array_filter($input, fn($haystack) => str_contains($haystack, $needle)); var_export( [ 'filtered' => $output, 'found' => $output ? 'yes' : 'no' ] );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tFhUm
function name:  (null)
number of ops:  19
compiled vars:  !0 = $input, !1 = $needle, !2 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, 'DEVICE'
   11     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          5        BIND_LEXICAL                                             ~5, !1
          6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !2, $6
   13     9        INIT_FCALL                                               'var_export'
   15    10        INIT_ARRAY                                       ~8      !2, 'filtered'
   16    11      > JMPZ                                                     !2, ->14
         12    >   QM_ASSIGN                                        ~9      'yes'
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~9      'no'
         15    >   ADD_ARRAY_ELEMENT                                ~8      ~9, 'found'
         16        SEND_VAL                                                 ~8
   13    17        DO_ICALL                                                 
   18    18      > 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/tFhUm
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $haystack, !1 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'str_contains'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.98 ms | 1013 KiB | 16 Q