3v4l.org

run code in 300+ PHP versions simultaneously
<?php $opts = array ( 'English', //'French', 'Spanish', //'Hindi', //'Korean', ); $langs = array ( 'English', 'French', 'Spanish', 'Hindi', 'Korean', ); $recs = array ( array ('name' => 'Bart Simpson', 'lang' => 'English, Spanish'), array ('name' => 'Homer Simpson', 'lang' => 'English'), array ('name' => 'Marge Simpson', 'lang' => 'Hindi, Korean'), array ('name' => 'Lisa Simpson', 'lang' => 'English, French, Spanish, Hindi, Korean'), ); print 'looking for : ' . implode (', ', $opts) . "\n\n"; foreach ($recs as $r) { if (lang_match ($r, $opts)) print 'YES: ' . $r['name'] . ' - ' . $r['lang'] . "\n"; else print 'no: ' . $r['name'] . ' - ' . $r['lang'] . "\n"; } function lang_match ($r, $opts) { $rlang = preg_split ('/\s*,\s*/', $r['lang']); foreach ($opts as $o) if (! in_array ($o, $rlang)) return false; return true; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 33
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 33
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/UJH57
function name:  (null)
number of ops:  35
compiled vars:  !0 = $opts, !1 = $langs, !2 = $recs, !3 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   18     2        ASSIGN                                                   !2, <array>
   25     3        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%2C+'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $7      
          7        CONCAT                                           ~8      'looking+for+%3A++', $7
          8        CONCAT                                           ~9      ~8, '%0A%0A'
          9        ECHO                                                     ~9
   27    10      > FE_RESET_R                                       $10     !2, ->33
         11    > > FE_FETCH_R                                               $10, !3, ->33
   29    12    >   INIT_FCALL_BY_NAME                                       'lang_match'
         13        SEND_VAR_EX                                              !3
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $11     
         16      > JMPZ                                                     $11, ->25
         17    >   FETCH_DIM_R                                      ~12     !3, 'name'
         18        CONCAT                                           ~13     'YES%3A+', ~12
         19        CONCAT                                           ~14     ~13, '+-+'
         20        FETCH_DIM_R                                      ~15     !3, 'lang'
         21        CONCAT                                           ~16     ~14, ~15
         22        CONCAT                                           ~17     ~16, '%0A'
         23        ECHO                                                     ~17
         24      > JMP                                                      ->32
   30    25    >   FETCH_DIM_R                                      ~18     !3, 'name'
         26        CONCAT                                           ~19     'no%3A++', ~18
         27        CONCAT                                           ~20     ~19, '+-+'
         28        FETCH_DIM_R                                      ~21     !3, 'lang'
         29        CONCAT                                           ~22     ~20, ~21
         30        CONCAT                                           ~23     ~22, '%0A'
         31        ECHO                                                     ~23
   27    32    > > JMP                                                      ->11
         33    >   FE_FREE                                                  $10
   38    34      > RETURN                                                   1

Function lang_match:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/UJH57
function name:  lang_match
number of ops:  22
compiled vars:  !0 = $r, !1 = $opts, !2 = $rlang, !3 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   35     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%2F%5Cs%2A%2C%5Cs%2A%2F'
          4        FETCH_DIM_R                                      ~4      !0, 'lang'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
   36     8      > FE_RESET_R                                       $7      !1, ->19
          9    > > FE_FETCH_R                                               $7, !3, ->19
         10    >   INIT_FCALL                                               'in_array'
         11        SEND_VAR                                                 !3
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $8      
         14        BOOL_NOT                                         ~9      $8
         15      > JMPZ                                                     ~9, ->18
         16    >   FE_FREE                                                  $7
         17      > RETURN                                                   <false>
         18    > > JMP                                                      ->9
         19    >   FE_FREE                                                  $7
   37    20      > RETURN                                                   <true>
   38    21*     > RETURN                                                   null

End of function lang_match

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.07 ms | 1400 KiB | 19 Q