Hello,
First of all, I’d just like to say that this forum is awesome! I’m a total programming newbie asking questions which have been sufficiently explained.
As I’m learning, really want to know the nuances of how the codes “operate”, not just settling for “that’s just the way it works”.
In that regard, I have this questions about assigning a variable to another variable (did I define that right?). I believe it is called REFERENCING?
[php]<?php
$firstVar = ‘nice day!’;
$secondVar = &$firstVar;
$secondVar = “Have a $secondVar”;
echo $firstVar;
echo $secondVar;
?>[/php]
…which outputs: Have a nice day! Have a nice day!
I sort of get the idea that the $firstVar is referenced via $secondVar.
What’s really confusing to me is the echos. It’s like the code is reading and echoing backwards from the last $secondVar to the middle and then $firstVar.
Shouldn’t the first echo $firstvar output “nice day! Have a” ? Obviously it is not, so I’d like to know how the code “thinks”.
Thanks in advance.
Chris