adrumsolo4u Posted February 28, 2007 Share Posted February 28, 2007 i want to include a php file, but have the function able to open a different file if one or both of the variables changes. heres how it should work: variable one is the folder variable two is the file include 'files/($var1)/($var2).php5'; how would i do this? i've looked, but nothing helps. Link to comment https://forums.phpfreaks.com/topic/40435-including-a-php-file-using-variables/ Share on other sites More sharing options...
emehrkay Posted February 28, 2007 Share Posted February 28, 2007 include ($var1 ."/". $var2); Link to comment https://forums.phpfreaks.com/topic/40435-including-a-php-file-using-variables/#findComment-195646 Share on other sites More sharing options...
adrumsolo4u Posted February 28, 2007 Author Share Posted February 28, 2007 going off of what you wrote: include ($sub0 ."/". $sub0 .".php5"); gives me an error Warning: include($sub0 ."/". $sub0 .".php5") [function.include]: failed to open stream: Invalid argument in C:\webs\index.php5 on line 5 Warning: include() [function.include]: Failed opening '$sub0 ."/". $sub0 .".php5"' for inclusion (include_path='.;C:\php5\pear') in C:\webs\index.php5 on line 5 i tried changing the characters ( and ) to ' '..which is how other includes are done include '$sub0 ."/". $sub0 .".php5"'; but this gives me an error as well Link to comment https://forums.phpfreaks.com/topic/40435-including-a-php-file-using-variables/#findComment-195770 Share on other sites More sharing options...
emehrkay Posted February 28, 2007 Share Posted February 28, 2007 echo $sub0 ."/". $sub0 .".php5"; and see what happens Link to comment https://forums.phpfreaks.com/topic/40435-including-a-php-file-using-variables/#findComment-195787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.