[pmwiki-users] Hg tweaks...
Patrick R. Michaud
pmichaud at pobox.com
Fri Feb 2 15:49:51 CST 2007
On Fri, Feb 02, 2007 at 09:03:15PM +0000, Américo Albuquerque wrote:
> Kathryn Andersen wrote:
> > Oh, I've also run into something puzzling, a line which I changed...
> > $FmtPV["$$hg"] = "'" . $gg . "'";
> > Wouldn't that work better as the following?
> > $FmtPV['$' . $hg] = "'" . $gg . "'";
> >
> > I'm not sure that the $$ will give what is needed. Or maybe I'm just
> > being paranoid.
> >
> Those sentences do different things. When you use ["$$hg"] you are
> saying to use the '$' character before the hg'. That is the same as
> writing ['$hg'] (note the single quotes). [...]
> Basically, the $$ inside double quotes is changed into a single $
Nope. "$$hg" is the same as '$' . $hg .
Here's a test script (also at http://www.pmichaud.com/sandbox/hg.php):
<?php
$hg = 'xyz';
header("Content-type: text/plain");
echo "$$hg", "\n";
echo '$' . $hg, "\n";
It outputs the following, showing that they are equivalent.
$xyz
$xyz
Note that this is different from using $$hg outside of quotes,
which treats $hg as being the name of a variable to look up.
Thus:
$hg = 'xyz';
$xyz = 'abc';
echo $$hg; # outputs 'abc';
Pm
More information about the pmwiki-users
mailing list