Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy. This forum is not for asking programming related questions.
Hello forum, I'm here looking for some help. I've searched through the internet looking for how to parse a config file. I have a file that looks like the following:
MAX_PLAYERS = 100
ENABLE_SPELLS = TRUE
I would like to read this from a file named test.cfg and set the values into variables. So far I have this :
<?php
// list of variables you want to make SURE the config cannot write to
$aryBlock = array('GLOBALS','_POST','_GET','_SERVER','_SESSION','_COOKIE','aryBlock');
// Do the rest of this for each line, however you are loading them in ($strLine would be one single like)
list($varName,$value) = explode('=',$strLine,2);
$varName = trim($varName);
if (!in_array($varName,$aryBlock)) {
if (strtolower($value)=='true') {
$$varName = TRUE;
}
elseif (strtolower($value)=='false') {
$$varName = FALSE;
}
else {
$$varName = $value;
}
}
?>
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.