Filename is: wn200.php
The script in the file is:
<?php
include ('projectstatus.php');
$id_title = explode(",",$wn200_id_title);
$proj_id = $id_title[0];
$title = $id_title[1];
?>
I want that "wn200" in the script should be automatically picked up from the filename. For that I am doing this:
$file_name = explode(".",basename($_SERVER['PHP_SELF']));
$file_name = $file_name[0];
So I have wn200 in the $file_name but how can I insert it in:
$id_title = explode(",",$wn200_id_title);
so that I don't have to write wn200 in the script.
After reading the comment about variable variable I tried this:
$file_name = explode(".",basename($_SERVER['PHP_SELF']));
$$n = $file_name[0];
include ('projectstatus.php'); // this file has $wn200_id_title = "wn200,Test"
$id_title = explode(",",$$n_id_title); // $$n part works but how do I connect it to _id_title so that the script reads it as $wn200_id_title = "wn200,Test"
$proj_id = $id_title[0]; // this shows "wn200"
$title = $id_title[1]; // this does not show "Test"
So I need to know how to connect $$n to _id_title so that it appears like $wn200_id_title in order to use its value in the script.