3v4l.org

run code in 500+ PHP versions simultaneously
<?php $needles = ['a','c','r','r']; $haystacks = ['carr','car','arc','ra','c','abc','do','aa','rr', 'rrr', 'caca', 'cacao']; $regexes = array_map(fn($v) => "/$v/", $needles); var_export( array_filter( $haystacks, fn($hay) => !preg_replace($regexes, '', $hay, 1) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dG1kc
function name:  (null)
number of ops:  18
compiled vars:  !0 = $needles, !1 = $haystacks, !2 = $regexes
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    6     2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          4        SEND_VAL                                                     ~5
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $6      
          7        ASSIGN                                                       !2, $6
    7     8        INIT_FCALL                                                   'var_export'
    8     9        INIT_FCALL                                                   'array_filter'
    9    10        SEND_VAR                                                     !1
   10    11        DECLARE_LAMBDA_FUNCTION                              ~8      [1]
         12        BIND_LEXICAL                                                 ~8, !2
   11    13        SEND_VAL                                                     ~8
    8    14        DO_ICALL                                             $9      
   11    15        SEND_VAR                                                     $9
    7    16        DO_ICALL                                                     
   12    17      > 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/dG1kc
function name:  {closure:/in/dG1kc:6}
number of ops:  6
compiled vars:  !0 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        ROPE_INIT                                         3  ~2      '%2F'
          2        ROPE_ADD                                          1  ~2      ~2, !0
          3        ROPE_END                                          2  ~1      ~2, '%2F'
          4      > RETURN                                                       ~1
          5*     > 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/dG1kc
function name:  {closure:/in/dG1kc:10}
number of ops:  11
compiled vars:  !0 = $hay, !1 = $regexes
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        INIT_FCALL                                                   'preg_replace'
          3        SEND_VAR                                                     !1
          4        SEND_VAL                                                     ''
          5        SEND_VAR                                                     !0
          6        SEND_VAL                                                     1
          7        DO_ICALL                                             $2      
          8        BOOL_NOT                                             ~3      $2
          9      > RETURN                                                       ~3
   11    10*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.05 ms | 1904 KiB | 17 Q