Click here to Skip to main content
15,867,594 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: And this is why I hate PHP (again) Pin
Moshe Katz30-Jul-12 4:09
Moshe Katz30-Jul-12 4:09 
GeneralRe: And this is why I hate PHP (again) Pin
BobJanova30-Jul-12 2:31
BobJanova30-Jul-12 2:31 
GeneralRe: And this is why I hate PHP (again) Pin
W Balboos, GHB30-Jul-12 2:34
W Balboos, GHB30-Jul-12 2:34 
GeneralRe: And this is why I hate PHP (again) Pin
ItsTobias30-Jul-12 2:47
ItsTobias30-Jul-12 2:47 
GeneralRe: And this is why I hate PHP (again) Pin
BobJanova31-Jul-12 0:18
BobJanova31-Jul-12 0:18 
GeneralRe: And this is why I hate PHP (again) Pin
ItsTobias31-Jul-12 0:35
ItsTobias31-Jul-12 0:35 
GeneralRe: And this is why I hate PHP (again) Pin
BobJanova1-Aug-12 0:11
BobJanova1-Aug-12 0:11 
GeneralRe: And this is why I hate PHP (again) Pin
ItsTobias1-Aug-12 0:34
ItsTobias1-Aug-12 0:34 
I agree learning rules about when you can and cant do certain things in a programming language is important and therefore there are context dependent rules for every language that must be learned from an early point. However I do not feel that (in this situation) within a double quoted string is enough of a context switch to cause the user to feel like they are now applying a different rule set.

This is especially true in this specific case because PHP will let you do the wrong thing(use un-qouted array indexes outside double quoted strings), other languages, if you apply the context rules in the wrong place you will likely get errors thrown at you and your code will not run (be it a compiled or scripted language) however in PHP in this specific situation(context) the PHP engine will "fix" your incorrect code, almost silently (How silent it is about this depends on your systems error display level), since this is a scripted language PHP has to fix your code every time. Since the user is none the wiser about their error, they will keep doing it that way in the future because "it just works", and then you end up with questions like "This works on my dev box but when I upload it to my live machine it throws errors all over the place!!!! this is why I hate PHP!!!!!"


The simpler your rule set, the easier it is to teach and to remember, I would (and am) strongly argue that teaching the use of $array[index] in any context should not be done and that the use of {} to wrap variables is a far more robust system, but I cant stop you, I can only comment on why I think teaching its use is bad in any situation.

I will not argue whether PHP is a good or a bad language to write websites in. It has its flaws(some which are quite major) but it has its positives to, like pretty much every programming language, I think its a great pick up and code language, kind of the VB of web languages Big Grin | :-D
GeneralRe: And this is why I hate PHP (again) Pin
ItsTobias30-Jul-12 2:47
ItsTobias30-Jul-12 2:47 
GeneralRe: And this is why I hate PHP (again) Pin
leif neland3-Aug-12 2:41
leif neland3-Aug-12 2:41 
GeneralRe: And this is why I hate PHP (again) Pin
BobJanova3-Aug-12 4:59
BobJanova3-Aug-12 4:59 
GeneralRe: And this is why I hate PHP (again) Pin
OriginalGriff30-Jul-12 2:32
mveOriginalGriff30-Jul-12 2:32 
GeneralRe: And this is why I hate PHP (again) Pin
W Balboos, GHB30-Jul-12 3:33
W Balboos, GHB30-Jul-12 3:33 
AnswerRe: And this is why I hate PHP (again) Pin
Moshe Katz30-Jul-12 4:08
Moshe Katz30-Jul-12 4:08 
GeneralRe: And this is why I hate PHP (again) Pin
W Balboos, GHB30-Jul-12 4:24
W Balboos, GHB30-Jul-12 4:24 
GeneralRe: And this is why I hate PHP (again) Pin
W Balboos, GHB2-Aug-12 8:27
W Balboos, GHB2-Aug-12 8:27 
GeneralRe: And this is why I hate PHP (again) Pin
ptcmariano30-Jul-12 5:14
ptcmariano30-Jul-12 5:14 
GeneralRe: And this is why I hate PHP (again) Pin
Florin Jurcovici30-Jul-12 2:54
Florin Jurcovici30-Jul-12 2:54 
GeneralIt doesn't stop there Pin
Jecc30-Jul-12 12:29
Jecc30-Jul-12 12:29 
GeneralRe: And this is why I hate PHP (again) Pin
riggaP30-Jul-12 13:35
riggaP30-Jul-12 13:35 
GeneralRe: And this is why I hate PHP (again) Pin
fuximus2-Aug-12 18:11
fuximus2-Aug-12 18:11 
GeneralI don't got time for no stinking opera! Pin
enhzflep22-Jul-12 8:30
enhzflep22-Jul-12 8:30 
GeneralRe: I don't got time for no stinking opera! Pin
Brisingr Aerowing22-Jul-12 12:45
professionalBrisingr Aerowing22-Jul-12 12:45 
GeneralRe: I don't got time for no stinking opera! Pin
_Amy22-Jul-12 22:29
professional_Amy22-Jul-12 22:29 
GeneralRe: I don't got time for no stinking opera! Pin
enhzflep22-Jul-12 22:54
enhzflep22-Jul-12 22:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.