3v4l.org

run code in 500+ PHP versions simultaneously
<?php $csv_specie = array("Mouse","Human"); $CDNA = 'Human interleukin 2 (IL2)a;Ampicillin resistance gene (amp)a;Mouse amp gene;Some other stuff unknown to man kind;some other human stuff'; $cdna = explode(";", $CDNA); Foreach($csv_specie as $specie){ $matches[$specie] = preg_grep("/\b" . $specie . "\b/i", $cdna); Echo $specie . " - " . implode("\n" . $specie . " - " , $matches[$specie]) . "\n"; // Remove matched items from $cdna $cdna = array_diff($cdna, $matches[$specie]); } // What is left in $cdna is not matched $matches["N/A"] = $cdna; Echo "\nN/A - " . implode("\nN/A - ", $matches["N/A"]); Echo "\n\n"; Var_dump($matches);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 32
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 32
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/64Qmq
function name:  (null)
number of ops:  44
compiled vars:  !0 = $csv_specie, !1 = $CDNA, !2 = $cdna, !3 = $specie, !4 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, 'Human+interleukin+2+%28IL2%29a%3BAmpicillin+resistance+gene+%28amp%29a%3BMouse+amp+gene%3BSome+other+stuff+unknown+to+man+kind%3Bsome+other+human+stuff'
    6     2        INIT_FCALL                                                   'explode'
          3        SEND_VAL                                                     '%3B'
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $7      
          6        ASSIGN                                                       !2, $7
    8     7      > FE_RESET_R                                           $9      !0, ->32
          8    > > FE_FETCH_R                                                   $9, !3, ->32
    9     9    >   INIT_FCALL                                                   'preg_grep'
         10        CONCAT                                               ~11     '%2F%5Cb', !3
         11        CONCAT                                               ~12     ~11, '%5Cb%2Fi'
         12        SEND_VAL                                                     ~12
         13        SEND_VAR                                                     !2
         14        DO_ICALL                                             $13     
         15        ASSIGN_DIM                                                   !4, !3
         16        OP_DATA                                                      $13
   10    17        CONCAT                                               ~14     !3, '+-+'
         18        CONCAT                                               ~15     '%0A', !3
         19        CONCAT                                               ~16     ~15, '+-+'
         20        FETCH_DIM_R                                          ~17     !4, !3
         21        FRAMELESS_ICALL_2                implode             ~18     ~16, ~17
         22        CONCAT                                               ~19     ~14, ~18
         23        CONCAT                                               ~20     ~19, '%0A'
         24        ECHO                                                         ~20
   13    25        INIT_FCALL                                                   'array_diff'
         26        SEND_VAR                                                     !2
         27        FETCH_DIM_R                                          ~21     !4, !3
         28        SEND_VAL                                                     ~21
         29        DO_ICALL                                             $22     
         30        ASSIGN                                                       !2, $22
    8    31      > JMP                                                          ->8
         32    >   FE_FREE                                                      $9
   17    33        ASSIGN_DIM                                                   !4, 'N%2FA'
         34        OP_DATA                                                      !2
   19    35        FETCH_DIM_R                                          ~25     !4, 'N%2FA'
         36        FRAMELESS_ICALL_2                implode             ~26     '%0AN%2FA+-+', ~25
         37        CONCAT                                               ~27     '%0AN%2FA+-+', ~26
         38        ECHO                                                         ~27
   20    39        ECHO                                                         '%0A%0A'
   21    40        INIT_FCALL                                                   'var_dump'
         41        SEND_VAR                                                     !4
         42        DO_ICALL                                                     
         43      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.9 ms | 2201 KiB | 17 Q