0

Is it possible to include files with a variable inside of include?

See this example:

$randfilescnt = rand(1,$filecount);

include('./quizes/Arrow/quiz'+ $randfilescnt +'.php');

How can I do this?

rajdev kumar
  • 3
  • 1
  • 4

2 Answers2

1

Like this way :

$randfilescnt = rand(1,$filecount);
include("./quizes/Arrow/quiz".$randfilescnt.".php");
Naushil Jain
  • 434
  • 3
  • 11
0

Use "." for string concat in php

 $randfilescnt = rand(1,$filecount);

    include('./quizes/Arrow/quiz'.$randfilescnt.'.php');
Shital Marakana
  • 2,817
  • 1
  • 9
  • 12