Re: Strange action with =&

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

 



Hello
    This (=&) is used in the variable references. in $ref=&$array["2"]  line 
$ref variable and $array["2"]  variable point at the same address. if you 
assign any value to this any variables, both of them will change their 
values because echo($ref) line display b on the screen.


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

"OKi98" <oki98@xxxxxxxxxx> wrote in message 
news:45D184C0.2060208@xxxxxxxxxxxxx
> Peter Beckman wrote:
>
>> Because I'm trying to point out a problem with PHP, where setting a
>>  reference when the other side is undefined or not set, PHP creates a
>>  reference to a previously non-existent array item, just by setting a
>>  reference.  I don't think that should happen.
>>
> And? what's wrong with that. The reference can be used in the future - I 
> think thats why it doesnt produce any error message.
> ie.
> $array=array("1"=>"a","3"=>"c");
> $ref=&$array["2"];
> $array["2"]="b";
> echo($ref);
>
>
> OKi98 

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux