r/badcode • • Nov 18 '20

php Intentionally Bad Code to show how Syntax errors worked

Post image
1 Upvotes

9 comments sorted by

8

u/Webmets Nov 18 '20

G E K O L O N I S E E R D jokes aside, not even a great way to show syntax errors, just over done bad code

1

u/Janes_Diary Nov 19 '20

Well, for starters, you used PHP, so that is failure number one. All succeeding failures are irrelevant because PHP.

2

u/Wonderful-Aardvark89 Nov 19 '20

its mandatory curriculum lmao

2

u/Janes_Diary Nov 19 '20

What backward school uses a practically dead language to teach web development?

4

u/[deleted] Nov 19 '20

It's not dead, it's still widely used

2

u/VFequalsVeryFcked Nov 21 '20

And it's still actively developed and improved upon

2

u/chepas_moi Nov 19 '20

Trop is te veel! This is a silly idea that puts too much importance on the IDE when at this stage you should be concentrated on the code and eventual call stacks.

2

u/[deleted] Nov 21 '20

Since people appreciated my comment last time, here we go:

  • variable names in Dutch

  • variable names getal1 and getal2 instead of something sensible

  • syntax error: variables in php are prefixed with a $ , missing from line 2 and 3

  • assigning a string to a variable getal. ("getal" means number)

  • line 4

    • style issue: inconsistent spacing around operands and operator

    • the second statement is invalid, probably first ; should be removed

  • line 5: just HTML in a PHP block with a semicolon

    • missing echo and quotes

    • it doesn't even print $resultaat

    • the message doesn't make sense, translation: "the result of these numbers is:"
      better message would be "het product van deze getallen is".