Im trying to find a way to unset an element if the first character is a certain letter, in this case the letter D… I’m not sure if there is an array function to do something of the sort or if a preg replace would do the trick?
[0] => Aaron [1] => Bob [2] => Carl [3] => Dale [4] => Devin [5] => Dylan
Unset all words that start with letter “D” Would result in:
[0] => Aaron [1] => Bob [2] => Carl
You could use the array_filter function:
If the letter you are going to be filtering by is going to change, you can build a really basic filtering class: