I working with my simple project which gets the variable name from another php file. Some variables has same value..
I used foreach to display variables in different php files in specific directory..
(1st app_config.php) $app_name = "Pass Generator";
(2nd app_config.php) $app_name = "Random Name Generator";
(3rd app_config.php) $app_name = "Love Meter";
(4th app_config.php) $app_name = "Random Name Generator";
(5th app_config.php) $app_name = "Lucky Number Generator";
Since my 2nd and 4th variable of $app_name has same value, how can I skip one of them. So the output will be:
Pass Generator
Random Name Generator
Love Meter
Lucky Number Generator
This is my code:
$path = '../../apps/' . $name[0];
$results = scandir($path);
foreach ($results as $result) {
if ($result === '.' or $result === '..') continue;
if (is_dir($path . '/' . $result)) {
require_once("../../apps/".$result."/app_config.php");
$app .= $app_name."<Br>";
}
}
echo $app_name;
Anyone? Thanks