Strange problem with overlapping names

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

 



Hi all,


the page shown below works fine on my own machine, but on another (remote)
server, it gives me a strange result.

Here's what happens: The first time I view the page it says "array(0) { }"
as I'd expect, but on the second it says "object(kurv)(0) { }" where I
expected another array. The problem seems to be that the object has the
same name as the key in $_SESSION -- if I call it $foobar the problem
disappears. But that explanation doesn't really make much sense to me.

As I see it there's something wrong on the server. Can anybody tell me
anything about this problem?


Thanks,
Niels




<?php

class kurv {
   function kurv() {
      if (!array_key_exists('kurv', $_SESSION)) {$_SESSION['kurv']=array();}
   }
}

session_start();

$kurv=new kurv();

var_dump($_SESSION['kurv']);

?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux