Michdd Posted October 18, 2008 Share Posted October 18, 2008 I'm trying to use this: foreach( $mon as $key => $monlist){ include('$monlist'); } When $monlist are different file destinations, but when I try to do that I get this error: Warning: include($monlist) [function.include]: failed to open stream: No such file or directory in /home/a3496022/public_html/add.php on line 146 Is there some other way to include something from a foreach statement? Link to comment https://forums.phpfreaks.com/topic/128941-solved-include-with-a-foreach/ Share on other sites More sharing options...
JasonLewis Posted October 18, 2008 Share Posted October 18, 2008 Anything inside single quotes are not parsed. So placing a variable in them won't parse the variable. Just remove the quotes, since its a variable you don't need them. Link to comment https://forums.phpfreaks.com/topic/128941-solved-include-with-a-foreach/#findComment-668506 Share on other sites More sharing options...
Michdd Posted October 18, 2008 Author Share Posted October 18, 2008 Anything inside single quotes are not parsed. So placing a variable in them won't parse the variable. Just remove the quotes, since its a variable you don't need them. OH, stupid mistake. Thanks a lot Link to comment https://forums.phpfreaks.com/topic/128941-solved-include-with-a-foreach/#findComment-668507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.