Kevin Falcone on Tue, 29 Feb 2000 00:49:12 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: php arrays


>>>>> "RS" == Robert Spier <rspier@speed.seas.upenn.edu> writes:
  >>> 2) all keys to arrays are stringified

  RS>     $foo = new someclass;
  RS>     $arr[ "$foo" ] = 'somevalue';
    
  RS>     leads to a key with value "Object" (the String "Object")

  RS>     Therefore -- I think 2) above is correct, assuming there is a
  RS> reasonable string representation.  (So, only strings and numbers can
  RS> be used as keys.)

Further proof

    class Fruit {
        var $color;

        function print_color() {
            echo $this->color;
        }
    }

    $banana = new Fruit;
    $banana->color = "yellow";

    $fruit = array();
    $fruit["$banana"] = 'chiquita';

    $x = each($fruit);
    echo "element $x[0] of \$fruit is $x[1] <br />";
    $x[0]->print_color();

dies in a "Call to a member function on a non-object"

Oh, and the above demonstrates that there is no private data in a PHP
object.

Also, session support stuff

The library I was talking about is here <http://phplib.netuse.de/>
And the part in the manual on session support in PHP is here 
<http://www.php.net/manual/ref.session.php3>

-kevin

-- 
Kevin Falcone <kevinfal@seas.upenn.edu>

"Anyone attempting to generate random numbers by deterministic means is, of
course, living in a state of sin."
-- John Von Neumann

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**