Skip to content

Instantly share code, notes, and snippets.

@hypothermic
Last active November 12, 2019 18:50
Show Gist options
  • Save hypothermic/365ca9392461f473c14ee24d08a448bc to your computer and use it in GitHub Desktop.
Save hypothermic/365ca9392461f473c14ee24d08a448bc to your computer and use it in GitHub Desktop.
Everything wrong with PHP

Everything wrong with PHP

  • In object-oriented programming, constructors aren't functions. But in PHP they are declared using function __construct. Weird.
  • No annotations/attributes! How are we supposed to provide metadata about class members?! (and no, phpdoc isn't an annotation, fuck off.)
  • Namespace separators are a backslash, which means they have to be escaped in JSON and other languages.
  • Why do constructors start with __? I've never used this key on my keyboard before.
  • No strict type enforcement / non-null types.
  • No casting to arrays, or specific types.
  • No typed variables within method signatures.
  • No mixed varargs.
  • Weird syntax for foreach. They should've just used for for both types, like Java has.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment