3v4l.org

run code in 300+ 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 = 35
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 35
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/64Qmq
function name:  (null)
number of ops:  50
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, ->35
          8    > > FE_FETCH_R                                               $9, !3, ->35
    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        INIT_FCALL                                               'implode'
         19        CONCAT                                           ~15     '%0A', !3
         20        CONCAT                                           ~16     ~15, '+-+'
         21        SEND_VAL                                                 ~16
         22        FETCH_DIM_R                                      ~17     !4, !3
         23        SEND_VAL                                                 ~17
         24        DO_ICALL                                         $18     
         25        CONCAT                                           ~19     ~14, $18
         26        CONCAT                                           ~20     ~19, '%0A'
         27        ECHO                                                     ~20
   13    28        INIT_FCALL                                               'array_diff'
         29        SEND_VAR                                                 !2
         30        FETCH_DIM_R                                      ~21     !4, !3
         31        SEND_VAL                                                 ~21
         32        DO_ICALL                                         $22     
         33        ASSIGN                                                   !2, $22
    8    34      > JMP                                                      ->8
         35    >   FE_FREE                                                  $9
   17    36        ASSIGN_DIM                                               !4, 'N%2FA'
         37        OP_DATA                                                  !2
   19    38        INIT_FCALL                                               'implode'
         39        SEND_VAL                                                 '%0AN%2FA+-+'
         40        FETCH_DIM_R                                      ~25     !4, 'N%2FA'
         41        SEND_VAL                                                 ~25
         42        DO_ICALL                                         $26     
         43        CONCAT                                           ~27     '%0AN%2FA+-+', $26
         44        ECHO                                                     ~27
   20    45        ECHO                                                     '%0A%0A'
   21    46        INIT_FCALL                                               'var_dump'
         47        SEND_VAR                                                 !4
         48        DO_ICALL                                                 
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.33 ms | 1020 KiB | 18 Q