Error:
failed to open stream: Permission denied in Unknown on line 0
Change file permissions.
Operators:
== equal
<> not equal
=== equal in value and type
= assign
= add to and assign
add with
echo '$a. ' ' .$b. ' ' .$c';
A || B
(either, or both)
A xor B
(either, not both) returns true IF A OR B is true; if both are true, returns false
AND
precedence
$a = $b AND $c
is the same as ( $a = $b ) AND $c
[from
http://www.php.net/manual/en/language.operators.logical.php]
dante at hearme dot com
14-Oct-1999 04:09
I wanted to do something like this:
$choice1 = "";
$choice2 = "dog";
$default = "other";
$val = $choice1 || $choice2 || $default;
but then $val1 will only contain 1 or 0. Instead I did this:
$choice1 = "";
$choice2 = "dog";
$default = "other";
$val = $choice1 or $choice2 or $default;
now $val contained the string "dog". That's
weird that 'or' is different from '||'...and I would
think that the '||' should be smart enough to handle
strings...the way PERL does. Guess not. Maybe it's
a design choice.
======================================================================
if xyada
DO THIS
else
DO THIS
can also be written
xyada ? DO THIS : DO THIS
switch( condition )
case 1:
stuff;
break;
case 2:
stuff;
break;
default:
stuff;
switch automatically performs a condition == test for each case. If your switch isn't working, it might be a better idea to explicitly test this way
switch( true )
case condition === case1:
stuff;
break;
case condition === case2:
Use quotation marks for verbatim strings.
"Today's date is Thu., Jan. 4."
Use apostrophes for strings that use control characters.
'Today\'s date is $date + %x %r %Z.'
Mail function
$to = "
[email protected]";
$subject=$_GET[ 'event_name' ];
$body = $_GET[ 'event_learned' ];
if( mail( $to, $subject, $body ) )
echo "Mail sent successfully";
else
echo "Sorry! Mail couldn't be sent.";
IF form contains <input name="address" />, it can be referred to in PHP file as $address
See
http://devzone.zend.com/node/view/id/646
setcookie("name", "value", "expiration", "domain", "path", "boolean")
EXAMPLE: setcookie("visited", "1", mktime()+86400, "/") or die("Could not set cookie");
to delete cookie, call setcookie with a date in the past for an expiration (e.g. mktime()-3600)