Answer the question
In order to leave comments, you need to log in
How to remove part of a string?
There is a line: 1,2,4,5,6,7,9,15,16... i.e. any numbers through ","
The numbers can be different and in a different order, you need to remove from this line, for example 4 (1,2,5,6,7,9...)
how to implement it?
Answer the question
In order to leave comments, you need to log in
implode(',', array_filter(explode(',', $str), function($n) {
return $n !== '4';
}))
substr(str_replace(',4,', ',', ",$str,"), 1, -1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question