3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dwellingInfo = [ ["AAA", "Chimney with red bricks"], ["BBB", "Two wide windows in the main floor"], ["CCC", "Roof tiles renewed in 2015"] ]; $haystack = implode( ',', array_column($dwellingInfo, 1) ); $dwellingAttributes = [ ["0001", 'Chimney', '/\b(?:Chimney with|Big stove)\b/i'], ["0002", 'Garden', '/\bgarden\b/i'], ["0003", 'Roof tiles', '/\bRoof tiles\b/i'], ["0004", 'Windows', '/\bwindows?\b/i'], ["0005", 'Garage', '/\b(?:garage|car port|under cover area)\b/i'] ]; $attributePatterns = [ "0001" => '/\b(?:Chimney with|Big stove)\b/i', "0002" => '/\bgarden\b/i', "0003" => '/\bRoof tiles\b/i', "0004" => '/\bwindows?\b/i', "0005" => '/\b(?:garage|car port|under cover area)\b/i' ]; foreach ($dwellingAttributes as [$id, $term, $pattern]) { printf( "%s - %s - %s\n", $id, $term, preg_match($attributePatterns[$id], $haystack) ? 'available' : 'unavailable' ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 31
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 31
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/clW4T
function name:  (null)
number of ops:  33
compiled vars:  !0 = $dwellingInfo, !1 = $haystack, !2 = $dwellingAttributes, !3 = $attributePatterns, !4 = $id, !5 = $term, !6 = $pattern
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   11     1        INIT_FCALL                                                   'array_column'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     1
          4        DO_ICALL                                             $8      
    9     5        FRAMELESS_ICALL_2                implode             ~9      '%2C', $8
          6        ASSIGN                                                       !1, ~9
   14     7        ASSIGN                                                       !2, <array>
   22     8        ASSIGN                                                       !3, <array>
   30     9      > FE_RESET_R                                           $13     !2, ->31
         10    > > FE_FETCH_R                                                   $13, $14, ->31
         11    >   FETCH_LIST_R                                         $15     $14, 0
         12        ASSIGN                                                       !4, $15
         13        FETCH_LIST_R                                         $17     $14, 1
         14        ASSIGN                                                       !5, $17
         15        FETCH_LIST_R                                         $19     $14, 2
         16        ASSIGN                                                       !6, $19
         17        FREE                                                         $14
   31    18        INIT_FCALL                                                   'printf'
   32    19        SEND_VAL                                                     '%25s+-+%25s+-+%25s%0A'
   33    20        SEND_VAR                                                     !4
   34    21        SEND_VAR                                                     !5
   35    22        FETCH_DIM_R                                          ~21     !3, !4
         23        FRAMELESS_ICALL_2                preg_match          ~22     ~21, !1
         24      > JMPZ                                                         ~22, ->27
   36    25    >   QM_ASSIGN                                            ~23     'available'
         26      > JMP                                                          ->28
   37    27    >   QM_ASSIGN                                            ~23     'unavailable'
         28    >   SEND_VAL                                                     ~23
   31    29        DO_ICALL                                                     
   30    30      > JMP                                                          ->10
         31    >   FE_FREE                                                      $13
   39    32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
207.45 ms | 1922 KiB | 15 Q