0

hello everybody,

i want to pass directory name as a variable in include function like this,

$page = 'test';
include('$page/test.php');

i know this a wrong way, but i don't know how to do it.
please anybody help in this regard.

Thank in advance....

3
Contributors
4
Replies
6
Views
8 Years
Discussion Span
Last Post by servis
0

Use double quotes. Single quoted strings aren't parsed.

$page = 'test';
include("$page/test.php");

# this will also work
include($page . '/test.php');
0

but this code is not working, some else solution please....

0

The proposed code works 100%, but maybe you have not explained precisely what do you want to do, or what errors you have, etc.

What pritaeas proposed is a 100% working solution to what you have described in your first post as a requirement.

0

yes, it was my mistake. this code is working fine......
Thank you very much Pritaeas and Rhyan......

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.