There are require
and include_once
as well.
So your question should be...
- When should I use
require
vs. include
?
- When should I use
require_once
vs. require
The answer to 1 is described here.
The require() function is identical to include(), except that it handles errors differently. If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will stop.
The answer to 2 can be found here.
The require_once() statement is identical to require() except PHP will check if the file has already been included, and if so, not include (require) it again.
Incrementing / Decrementing Operators
++
increment operator
--
decrement operator
Example Name Effect
---------------------------------------------------------------------
++$a Pre-increment Increments $a by one, then returns $a.
$a++ Post-increment Returns $a, then increments $a by one.
--$a Pre-decrement Decrements $a by one, then returns $a.
$a-- Post-decrement Returns $a, then decrements $a by one.
These can go before or after the variable.
If put before the variable, the increment/decrement operation is done to the variable first then the result is returned. If put after the variable, the variable is first returned, then the increment/decrement operation is done.
For example:
$apples = 10;
for ($i = 0; $i < 10; ++$i) {
echo 'I have ' . $apples-- . " apples. I just ate one.\n";
}
Live example
In the case above ++$i
is used, since it is faster. $i++
would have the same results.
Pre-increment is a little bit faster because it really increments the variable and after that 'returns' the result. Post-increment creates a special variable, copies there the value of the first variable and only after the first variable is used, replaces its value with second's.
However, you must use $apples--
, since first, you want to display the current number of apples, and then you want to subtract one from it.
You can also increment letters in PHP:
$i = "a";
while ($i < "c") {
echo $i++;
}
Once z
is reached aa
is next, and so on.
Note that character variables can be incremented but not decremented and even so only plain ASCII characters (a-z and A-Z) are supported.
Stack Overflow Posts:
Best Answer
"Configuration File (php.ini) Path" is where by default php.ini should be/PHP will look for by default (this path is may be the %windir env var for Win distro?).
I believe that in your apache config you have PHPINIDir, that define explicitly a new path to the ini file. If you don't have php.ini in there, then PHP defaults will be used (even if you have php.ini in the C:\Windows folder). At least this is the case when PHP is used as module (which is my config and I'm able to test on).
So "Loaded Configuration File" is your currently loaded config file and the one you should edit.