if (stripos(strrev($file), "gpj.") === 0) || (stripos(strrev($file), "fig.") === 0) || (stripos(strrev($file), "gnp.") === 0) { You have too many parenthesis: if (stripos(strrev($file), "gpj.") === 0) <-- this ends the if statement; the next || is unexpected. Also, at the end, you're missing a parentheses at the end: (stripos(strrev($file), "gnp.") === 0) should be(stripos(strrev($file), "gnp.") === 0)) -- GREG