Link to home
Create AccountLog in
Avatar of locke2005
locke2005Flag for Brazil

asked on

complicated PHP manual parts

What do these parts mean???


Note that the assignment copies the original variable to the new one (assignment by value),
so changes to one will not affect the other. This may also have relevance if you need to copy
something like a large array inside a tight loop. Assignment by reference is also supported,
using the $var = &$othervar; syntax. 'Assignment by reference' means that both variables end
up pointing at the same data, and nothing is copied anywhere. To learn more about references,
please read References explained. As of PHP 5, objects are assigned by reference unless
explicitly told otherwise with the new clone keyword.

Assignment Operators - Manual

http://www.php.net/manual/en/language.operators.assignment.php 


Note:  Please note that the ternary operator is a statement, and that it doesn't evaluate to a
variable, but to the result of a statement. This is important to know if you want to return a
variable by reference. The statement return $var == 42 ? $a : $b; in a return-by-reference
function will therefore not work and a warning is issued in later PHP versions.

Comparison Operators - Manual

http://www.php.net/manual/en/language.operators.comparison.php


// "||" has a greater precedence than "or"
$e = false || true; // $e will be assigned to (false || true) which is true
$f = false or true; // $f will be assigned to false
var_dump($e, $f);

// "&&" has a greater precedence than "and"
$g = true && false; // $g will be assigned to (true && false) which is false
$h = true and false; // $h will be assigned to true
var_dump($g, $h);

Logical Operators - Manual

http://www.php.net/manual/en/language.operators.logical.php


Note:  You should never use parentheses around your return variable when returning by
reference, as this will not work. You can only return variables by reference, not the result
of a statement. If you use return ($a); then you're not returning a variable, but the result
of the expression ($a)  (which is, of course, the value of $a).

return - Manual

http://www.php.net/manual/en/function.return.php


If the target server interprets the target file as PHP code, variables may be passed to the
included file using a URL request string as used with HTTP GET. This is not strictly speaking
the same thing as including the file and having it inherit the parent file's variable scope;
the script is actually being run on the remote server and the result is then being included
into the local script.

include - Manual

http://www.php.net/manual/en/function.include.php
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of locke2005

ASKER

Please, explain the last 3 complicated PHP manual parts!
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
There is only the #2 remaining! Thank you for the help so far!
#2?  The ternary one?  Just answered.
Thanks a lot!!!