a few questions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

a few questions

Post by s.dot »

A few things I've been wondering for a while

$foo &= $bar
what's this?

if($a === $b)
if($a !== $b)
why three comparison operators?

$$var
why two $s?
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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

  1. &= is a bitwise operator. It means L-value = L-value & R-value
  2. === is the identity operator. It's similar to == the equality operator, but also requires the type of the operands to be the same. Same sort of thing for !== being the types must match as well as the values to fail.

    Code: Select all

    '1' == 1; // true
    '1' === 1; // false
    
    '1' != 1; // false
    '1' !== 1; // true
  3. $$var is variable variables. The value in $var is considered the name of a variable thus accessed or set (depending on context)

    Code: Select all

    $foo = 'bar';
    $$foo = 64;
    echo $bar;
Post Reply