Placing a foreach loop inside an if condition

Erin

New Member
I am needing to create a foreach statement that will run through and create conditions for a conditional statement. I wrote this bit of code, not expecting it to work, and of course it didn't...\[code\]$filename = "whitelist.txt";$handle = fopen($filename, 'r');$whitelist = fread($handle, filesize($filename));fclose($handle);$whitelist = explode("\n", $whitelist);if ( foreach ($whitelist as $value) { strpos($ref, 'http://'.$value.'/')===0 || })\[/code\]So, should this ever be able to work? Or am I just crazy? If there is really no way to put a loop in the condition like this, could someone suggest a better way to do this? Much appreciated!
 
Back
Top