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);
Output for git.master, git.master_jit, rfc.property-hooks
Mouse - Mouse amp gene Human - Human interleukin 2 (IL2)a Human - some other human stuff N/A - Ampicillin resistance gene (amp)a N/A - Some other stuff unknown to man kind array(3) { ["Mouse"]=> array(1) { [2]=> string(14) "Mouse amp gene" } ["Human"]=> array(2) { [0]=> string(26) "Human interleukin 2 (IL2)a" [4]=> string(22) "some other human stuff" } ["N/A"]=> array(2) { [1]=> string(33) "Ampicillin resistance gene (amp)a" [3]=> string(36) "Some other stuff unknown to man kind" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
36.21 ms | 407 KiB | 5 Q