Re: Strange action with =&
| From: | Haydar Tuna | Date: | Tue, 20 Feb 2007 09:18:39 +0000 |
| Subject: | Re: Strange action with =& | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-43106@lists.php.net to get a copy of this message | ||
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@centrum.cz> wrote in message
news:45D184C0.2060208@centrum.cz...
> 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