3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fullArtistTimes = [ ['time' => '18:31:00', 'artist' => 'LUIS RODRIGUEZ & DEN HARROW'], ['time' => '18:32:00', 'artist' => 'J BALVIN'], ['time' => '18:33:00', 'artist' => 'THE BLACK EYED PEAS FT J BALVIN'], ['time' => '18:34:00', 'artist' => 'THE BLACK EYED PEAS FT J BALVIN'], ['time' => '18:35:00', 'artist' => 'J BALVIN'] ]; $fullArtist = 'THE BLACK EYED PEAS FT J BALVIN'; $artistDelimiters = '~ (?:[+e,&]|and|f(?:ea)?t\.?|vs\.?) ~i'; $artists = array_flip(preg_split($artistDelimiters, $fullArtist)); $result = []; foreach ($fullArtistTimes as $row) { foreach (preg_split($artistDelimiters, $row['artist']) as $artist) { if (isset($artists[$artist])) { $result[] = "{$artist} is at {$row['time']}"; } } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 32
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 32
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 30
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 29
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 30
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/bRaJl
function name:  (null)
number of ops:  37
compiled vars:  !0 = $fullArtistTimes, !1 = $fullArtist, !2 = $artistDelimiters, !3 = $artists, !4 = $result, !5 = $row, !6 = $artist
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, 'THE+BLACK+EYED+PEAS+FT+J+BALVIN'
   13     2        ASSIGN                                                   !2, '%7E+%28%3F%3A%5B%2Be%2C%26%5D%7Cand%7Cf%28%3F%3Aea%29%3Ft%5C.%3F%7Cvs%5C.%3F%29+%7Ei'
   15     3        INIT_FCALL                                               'array_flip'
          4        INIT_FCALL                                               'preg_split'
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $10     
          8        SEND_VAR                                                 $10
          9        DO_ICALL                                         $11     
         10        ASSIGN                                                   !3, $11
   17    11        ASSIGN                                                   !4, <array>
   18    12      > FE_RESET_R                                       $14     !0, ->32
         13    > > FE_FETCH_R                                               $14, !5, ->32
   19    14    >   INIT_FCALL                                               'preg_split'
         15        SEND_VAR                                                 !2
         16        FETCH_DIM_R                                      ~15     !5, 'artist'
         17        SEND_VAL                                                 ~15
         18        DO_ICALL                                         $16     
         19      > FE_RESET_R                                       $17     $16, ->30
         20    > > FE_FETCH_R                                               $17, !6, ->30
   20    21    >   ISSET_ISEMPTY_DIM_OBJ                         0          !3, !6
         22      > JMPZ                                                     ~18, ->29
   21    23    >   ROPE_INIT                                     3  ~22     !6
         24        ROPE_ADD                                      1  ~22     ~22, '+is+at+'
         25        FETCH_DIM_R                                      ~20     !5, 'time'
         26        ROPE_END                                      2  ~21     ~22, ~20
         27        ASSIGN_DIM                                               !4
         28        OP_DATA                                                  ~21
   19    29    > > JMP                                                      ->20
         30    >   FE_FREE                                                  $17
   18    31      > JMP                                                      ->13
         32    >   FE_FREE                                                  $14
   26    33        INIT_FCALL                                               'var_export'
         34        SEND_VAR                                                 !4
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.68 ms | 1005 KiB | 16 Q