<groogs[h]> yes, you're right, AMPWEBROOT is the right var to use there
<groogs[h]> and IIRC, it will always be set properly (parse_amportal_conf() takes care of that) so you don't need to do the default check there, not that it hurts
<groogs[h]> however, your logic is a bit flawed
<groogs[h]> if ( (isset($amp_conf['AMPWEBROOT'])?$amp_conf['AMPWEBROOT']:'') == '') {
<groogs[h]> lets just pretend $a == $amp_conf['AMPWEBROOT'] because it's eaeier to write
<groogs[h]> (isset($a) ? $a : '') == ''
<groogs[h]> if $a is set, that is the same as $a == '' .. which is good
<groogs[h]> but if its not set, thats the same as '' == ''
<groogs[h]> which DOES work out, but its quite confusing to look at, took me a few seconds
<groogs[h]> really what you want to say there is !isset($a) || $a == ''
<groogs[h]> as in, "if $a is not set, or $a is equal to blank string"
<groogs[h]> now.. $path = $ampwebroot_path
<groogs[h]> first off, missing the ;
<groogs[h]> secondly, its kind of pointless, it's just setting one variable to be the other. stick with $ampwebroot_path
<philippel> $ampwebroot_path = isset($acmp_conf['AMWEBROOT'}) ? $amp_conf['AMPWEBROOT'] : "/var/www/html"
<groogs[h]> $fd = fopen('$path/admin/modules/weather/zipcodes.sql','r');
* hi365 has quit (Read error: 110 (Connection timed out))
* [1]hi365 is now known as hi365
<groogs[h]> that's ALMOST fine, execpt that php doesn't interpret variables inside single quotes, only inside double quotes
<groogs[h]> so either: "$ampwebroot_path/admin/modules/weather/zipcodes.sql" or (my preference): $ampwebroot_path.'/admin/modules/weather/zipcodes.sql'
<groogs[h]> the rest of it looks fine
<groogs[h]> and yeah, like philippel points out, you can actually shorten that whole if statement to one line
<groogs[h]> and $a == '' is actually the same as empty($a)
<philippel> other than - as groogs[h] points out, it is not needed cause already done for you
<groogs[h]> so you could write if (!isset($a) || empty($a)) { ... }
<groogs[h]> and going even further, use the ternary operator and make it just one line, like philippel's example.. $ampwebroot_path = (!isset($a) || empty($a)) ? '/var/www/html' : $a;
<groogs[h]> but that's negative logic, and is hard to read, so the reverse is easier .. $ampwebroot_path = (isset($a) && !empty($a)) ? $a : '/var/www/html';
<groogs[h]> (replacing, of course, $a with $amp_conf['AMPWEBROOT'])
<groogs[h]> and your free bonus extra .. php uses "short circuit logic" when evaluating expressions .. it evaluates left to right (it's actually slightly more complex, see search for "order of precidence"), so when it sees isset($a) && !empty($a) if isset($a) returns false, it will never evaluate the !empty($a) part because it doesn't matter what it is, the expression always evaluates to false