For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > February 2007 > Re: [PHP-DB] Strange action with =&









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Strange action with =&
Peter Beckman

2007-02-13, 3:58 am

On Tue, 13 Feb 2007, bedul wrote:

> sry i don't get what u mean??
>

This is how you assign a variable by reference. $rate should be a
reference to $mydata[$prefix], not a copy. If I change the value of
$rate, the value of $mydata[$prefix] is also changed, and vice versa.
[color=darkred]
>
> the reason mydata2 empty was because it don't have value in it!!
>
> full source plz
> why u don't try this
>
> $txt.="<ol>";
> foreach($mydata as $nm=>$val){
> $txt.="\n<li> $nm = $val";
> $txt2="<br>\$mydata[$nm] = $val";
> }
> $txt.="</ol>";
>
> print $txt;


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.

Your code doesn't set anything by reference.

>
> we should cross check again.


I don't know what you mean.

---------------------------------------------------------------------------
Peter Beckman Internet Guy
beckman@purplecow.com http://www.purplecow.com/
---------------------------------------------------------------------------
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com