logitech2004 logitech2004 - 10 days ago 6
PHP Question

SKip the variable that start with a word and ends BY number [0-9]

I have this array

arr("PAPER","SHEET","SHEET1","SHEET2", "SHEET3")
with a loop
foreach(key,value)
. I will skip the variable that start with "SHEET" and ends with a number
[0-9]


How to do this with
preg_math
or other REGEX?

if(Condition){
Code...
}

Answer

Something like:

if (preg_match('/^SHEET\d+$/i', $value)) {
    continue;
}
Comments