dreamwest Posted August 21, 2009 Share Posted August 21, 2009 Im trying to loop an array - but have no idea where to begin.. $files = array('546.jpg', '1_546.jpg', '2_546.jpg', '3_546.jpg'); while( $files etc){ if (file_exists($files)) { do something here } } Quote Link to comment https://forums.phpfreaks.com/topic/171242-solved-loop-an-array/ Share on other sites More sharing options...
dreamwest Posted August 21, 2009 Author Share Posted August 21, 2009 Nevermind, figured it out $id = 456; $arr = array("{$id}.jpg", "1_{$id}.jpg", "2_{$id}.jpg", "3_{$id}.jpg"); foreach ($arr as &$value) { echo "Let do stuff to ".$value."<br>"; } Quote Link to comment https://forums.phpfreaks.com/topic/171242-solved-loop-an-array/#findComment-903037 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.