[pmwiki-users] Problem with $FmtPV;
Patrick R. Michaud
pmichaud at pobox.com
Tue May 22 14:36:14 CDT 2007
On Tue, May 22, 2007 at 02:53:42PM -0400, Vince Admin Account wrote:
>
> On May 22, 2007, at 2:47 PM, Patrick R. Michaud wrote:
>
> >On Tue, May 22, 2007 at 01:05:08PM -0400, Ben Wilson wrote:
> >>On 5/22/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> >>>For example, in PHP I can write:
> >>>
> >>> $x = a2007W19;
> >>>
> >>>PHP automaticaly treats the bareword string as though I had written:
> >>>
> >>> $x = 'a2007W19';
> >
> >I should also note that even though PHP _allows_ a programmer
> >to write bareword strings in this way, doing so is considered
> >very bad (and potentially unsafe) programming practice.
>
> Patrick, please don't end there. Tell us what should be done.
> Is it $x="a2007W19" or ...
Oh. In general one should use single quotes instead of
bareword strings:
$x = a2007W19; # bad
$x = 'a2007W19'; # good
The same goes for constant string indexes inside of arrays:
$a = $x[color]; # bad
$a = $x['color']; # good
Pm
More information about the pmwiki-users
mailing list