/ Published in: PHP
Remove $value from $array
Expand |
Embed | Plain Text
Comments
Subscribe to comments
You need to login to post a comment.
Remove $value from $array
Subscribe to comments
You need to login to post a comment.
To get around the problem if the last element needs to be removed (issue due to the missing comma at the end) you can use regular expressions:
// make sure to escape $patterntext as required $pattern = "/,*$patterntext,*/"; $new_array = explode(',', preg_replace($pattern, '' , (join(',',$array))));