The beauty of string parsing part 2
Somebody suggested that I use apostrophes in my string parsing examples. Sure!
<?php
error_reporting(E_ALL);
$array['test'] = "string used\n";
echo "$array['test']";
echo "{$array['test']}";
echo "${array['test']}";
$array = array();
$array['test'][1] = "string used\n";
echo "$array['test'][1]";
echo "{$array['test'][1]}";
echo "${array['test'][1]}";
?>So what will happen?
Well, half of this is a syntax error. You need to comment out a few:
<?php
error_reporting(E_ALL);
$array['test'] = "string used\n";
#echo "$array['test']";
echo "{$array['test']}";
echo "${array['test']}";
$array = array();
$array['test'][1] = "string used\n";
#echo "$array['test'][1]";
echo "{$array['test'][1]}";
#echo "${array['test'][1]}";
?>So... are you still sure the WTF comes from me omitting apostrophes? :p

Comments
Whaaat? Why are you
Whaaat? Why are you commenting lines with a hash instead of two slashes? That's the *real* WTF! How can you ignore PHP/Drupal coding standards so brazenly?!?!?!
:P
A hash? The Python dark side
A hash? The Python dark side got you too? :P
P.S.
I know it's valid, just an observation.
Totally glad I'm not the only
Totally glad I'm not the only one who has found herself commenting PHP with hashes.
It's valid syntax, why not use it? It's easier than // to type and pick out at a glance.
Infact all the alternate syntax that PHP gives you for uh.. everything is a WTF in and of itself.
bavabiaps
Unmappyaspels
Bweg
Dicsaspickeri
ywod
Post new comment