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.
er
i think the wtf is more along the lines of you thinking you are smarter than the already documented string evaluation procedures.
It is great to have the
It is great to have the opportunity to read a good quality article with useful information on topics that plenty are interested on
412-79 exam
JN0-100 exam
640-821 exam
70-562 exam
642-647 exam
70-624 exam
156-215 exam
70-652 exam
It is so lucky to read your
It is so lucky to read your blog,it is full of useful message.I wish we both can do better in the future.It great honor if you can visit our website,and give us some suggestion.
PK0-002 dumps
642-524 dumps
1Y0-A05 dumps
646-205 dumps
640-461 dumps
640-811 dumps
1z0-053 dumps
SK0-003 dumps
Post new comment