For an example I have tons of regex as simple I wrote:
php > var_dump( preg_split('/[:reg\s{}]+/', ':reg{/^[a-zA-Z]*$/}') );
array(3) {
[0] =>
string(0) ""
[1] =>
string(13) "/^[a-zA-Z]*$/"
[2] =>
string(0) ""
}
I want remove empty arrays [0] => string(0) ""
for example a result should be:
php > var_dump( preg_split('????', ':reg{/^[a-zA-Z]*$/}') );
array(3) {
[0] =>
string(13) "/^[a-zA-Z]*$/"
}
I know array_filter()
function when remove empty arrays, but I want using regular expression only.