Saturday 26 May 2018

How do I remove all elements with a particular value from a php array? (in the shortest way possible)

For instance:



$array = ["a", "b", "c", "a", "a"];


I want to remove all "a" elements to get output:




$array = ["b", "c"];


Should also work for ints and floats.Thanks guys!

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...