-2

I want to do this: <?php include_once ("includes/'<?php echo $mymodule1; ?>'.php"); ?>

I try before with: <?php include_once ("includes/'.echo $mymodule1.'.php"); ?>

But not work :(

You can help me?, many thanks :)

Fran
  • 1
  • 1

3 Answers3

2

include_once isn't really a function. Only kind of.

Putting a variable in a string:

include_once "includes/{$mymodule1}.php";
JakeParis
  • 11,056
  • 3
  • 42
  • 65
0

Write down the variable without the echo statement. Either do this:

<?php include_once ("includes/" . $mymodule1 . ".php"); ?>

or this:

<?php include_once ("includes/$mymodule1.php"); ?>
Wais Kamal
  • 5,858
  • 2
  • 17
  • 36
0

You can directly put the variable , no need for echo here

<?php 
include_once('includes/'.$yourvar.'.php');
?>