0

i describe my question with example:

-index.php file content:

<?php
require_once(funcfile1.php);
include(funcfile2.php);
?>
<div><?php echo $var1; ?></div>

-funcfile1.php content:

<?php
$var1 = 'html codes'.$var2.'htmlcodes'.**[MY QUESTION]**.'other html or php cods'
?>

you see in index file echo $var1 that is in funfile1.php

but now i want add a variable for echo in [MY QUESTION] that this variable need funcfile2.php include

and funcfile2 just include in index.php

what can i do?

2
  • what you got when try your example Commented Aug 2, 2013 at 13:20
  • Can you show us your real code instead? Commented Aug 2, 2013 at 13:21

1 Answer 1

2

include the funfile2.php into funfile1.php. and when you will include the funfile1.php in index.php then funfile2.php file will also be include in index.php file.

-funcfile1.php content:

<?php
include(funcfile2.php);
$var1 = 'html codes'.$var2.'htmlcodes'.**[MY QUESTION]**.'other html or php cods'
?>

And index.php content will be:

<?php
require_once(funcfile1.php); 
// remove include funcfile1.php from here as it was includeed in funcfile1.php
?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.