fork download
  1. <?php
  2. function removeDigits($string, array $digits) {
  3. return join(",", array_diff(explode(",", $string), $digits));
  4. }
  5.  
  6. $str = "1,2,3,4,5,6";
  7. $ignore = [1, 4, 5];
  8.  
  9. print_r(removeDigits($str, $ignore));
  10.  
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
2,3,6