General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lawrence D’Oliveiro
Fireship
comments
Comments by "Lawrence D’Oliveiro" (@lawrencedoliveiro9104) on "PHP in 100 Seconds" video.
0:59 PHP started out by trying to copy Perl without really understanding how it worked. These days, they’ve moved on to trying to copy Python, again without really understanding how it works.
3
Things to consider: * There is a book called JavaScript: The Good Parts . There is no book called PHP: The Good Parts . * PHP has a “===” operator (and so does JavaScript). Python doesn’t have one, doesn’t need one. * PHP has no module system. You have to “include” source files, so everything gets defined in a common namespace. Python has no “include”; instead you “import” separate modules, and their contents stay in their own namespaces. Even JavaScript has figured out modules now.
2
Python is dynamically typed, yet also strongly typed. To understand the difference, think about why PHP needs the “===” operator, and Python doesn’t.
1
1:42 Unfortunately, functions can either be first-class, or be named, but they cannot be both.
1
Doesn’t matter how advanced a framework is, if it’s built on a crappy language. Example: str_split() doesn’t work properly on empty strings. Yet when I try adding a note about this to the PHP docs, it gets deleted.
1
@rafadydkiemmacha7543 Python has strict typing. Every object is an instance of a class.
1
@rafadydkiemmacha7543 It’s a very fundamental feature. Functions and classes are objects. All objects are instances of some class. That means that functions and classes, too, are instances of classes.
1
PHP users have no idea about Python, do they?
1
1:32 This is one aspect of PHP’s language design which shows what happens when you only think about things part way. Understandably, they did not want to copy the Perl (mis)feature of implicitly declaring all variables as global unless specified otherwise. So they decided that all variables would be local unless specified otherwise. This turned out to be a nuisance for global data like “GET” and “POST”. So they decided that built-in globals would become “superglobals”, visible everywhere without having to be declared global. Too bad about not being able to do the same with your own globals! Python adopted a different, admittedly slightly more complex rule: assigning to a variable would automatically create it as local, unless declared otherwise; but you could refer to an existing global/nonlocal variable without having to declare it (provided you did not also try to assign to it).
1