3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dataset=[[3,"Yellow","Banana"], [2,"Brown","Ananas"], [1,"Green","brown"]]; $dataset = array_filter($dataset, function ($v){ return filterArray('anana', $v); }); function filterArray($needle,$haystack){ foreach($haystack as $v){ if (stripos($v, $needle) !== false) return true; }; return false; } echo '<pre>'; print_r($dataset); echo '</pre>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cNARN
function name:  (null)
number of ops:  13
compiled vars:  !0 = $dataset
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    5     1        INIT_FCALL                                                   'array_filter'
          2        SEND_VAR                                                     !0
          3        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
    7     4        SEND_VAL                                                     ~2
    5     5        DO_ICALL                                             $3      
          6        ASSIGN                                                       !0, $3
   16     7        ECHO                                                         '%3Cpre%3E'
          8        INIT_FCALL                                                   'print_r'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                                     
         11        ECHO                                                         '%3C%2Fpre%3E'
         12      > 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/cNARN
function name:  {closure:/in/cNARN:5}
number of ops:  7
compiled vars:  !0 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    6     1        INIT_FCALL_BY_NAME                                           'filterArray'
          2        SEND_VAL_EX                                                  'anana'
          3        SEND_VAR_EX                                                  !0
          4        DO_FCALL                                          0  $1      
          5      > RETURN                                                       $1
    7     6*     > RETURN                                                       null

End of Dynamic Function 0

Function filterarray:
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/cNARN
function name:  filterArray
number of ops:  16
compiled vars:  !0 = $needle, !1 = $haystack, !2 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   10     2      > FE_RESET_R                                           $3      !1, ->13
          3    > > FE_FETCH_R                                                   $3, !2, ->13
   11     4    >   INIT_FCALL                                                   'stripos'
          5        SEND_VAR                                                     !2
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $4      
          8        TYPE_CHECK                                      1018          $4
          9      > JMPZ                                                         ~5, ->12
         10    >   FE_FREE                                                      $3
         11      > RETURN                                                       <true>
   10    12    > > JMP                                                          ->3
         13    >   FE_FREE                                                      $3
   13    14      > RETURN                                                       <false>
   14    15*     > RETURN                                                       null

End of function filterarray

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
131.99 ms | 485 KiB | 10 Q