3v4l.org

run code in 300+ 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 = 13, Position 2 = 37
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 37
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/clW4T
function name:  (null)
number of ops:  39
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>
    9     1        INIT_FCALL                                               'implode'
   10     2        SEND_VAL                                                 '%2C'
   11     3        INIT_FCALL                                               'array_column'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $8      
          7        SEND_VAR                                                 $8
    9     8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !1, $9
   14    10        ASSIGN                                                   !2, <array>
   22    11        ASSIGN                                                   !3, <array>
   30    12      > FE_RESET_R                                       $13     !2, ->37
         13    > > FE_FETCH_R                                               $13, $14, ->37
         14    >   FETCH_LIST_R                                     $15     $14, 0
         15        ASSIGN                                                   !4, $15
         16        FETCH_LIST_R                                     $17     $14, 1
         17        ASSIGN                                                   !5, $17
         18        FETCH_LIST_R                                     $19     $14, 2
         19        ASSIGN                                                   !6, $19
         20        FREE                                                     $14
   31    21        INIT_FCALL                                               'printf'
   32    22        SEND_VAL                                                 '%25s+-+%25s+-+%25s%0A'
   33    23        SEND_VAR                                                 !4
   34    24        SEND_VAR                                                 !5
   35    25        INIT_FCALL                                               'preg_match'
         26        FETCH_DIM_R                                      ~21     !3, !4
         27        SEND_VAL                                                 ~21
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $22     
         30      > JMPZ                                                     $22, ->33
   36    31    >   QM_ASSIGN                                        ~23     'available'
         32      > JMP                                                      ->34
   37    33    >   QM_ASSIGN                                        ~23     'unavailable'
         34    >   SEND_VAL                                                 ~23
   31    35        DO_ICALL                                                 
   30    36      > JMP                                                      ->13
         37    >   FE_FREE                                                  $13
   39    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.64 ms | 1006 KiB | 17 Q