3 ms·
JavaScript even in 1996 was much saner language than PHP. Surely there were bad parts, but in JS you could just ignore them. In PHP on the other hand one had to
by fpoling 6y ago
JavaScript even in 1996 was much saner language than PHP. Surely there were bad parts, but in JS you could just ignore them. In PHP on the other hand one had to build on top of bad parts since there was no good alternatives.
- coldtea 6y ago>In PHP on the other hand one had to build on top of bad parts since there was no good alternatives. What exactly was so bad in PHP that you couldn't also ignore?
- blablabla123 6y agoSomeone posted an article above [1], but citing from it, there is a function called mysql_real_escape_string. Although early JS also has quite odd language choices, it follows a consistent philosophy. To me it boils down to LISP in C syntax with weak typing. Past PHP feels more like a collection of stuff. But I assume modern PHP can be a viable choice if used with a modern framework, linter etc. [1] https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
- TimWolla 6y agoPHP follows a consistent philosophy as well. The PHP functions are usually named after the C functions they wrap. And in fact: The MySQL C client library contains a function called mysql_real_escape_string. see: https://dev.mysql.com/doc/c-api/8.0/en/mysql-real-escape-string.html https://dev.mysql.com/doc/c-api/8.0/en/mysql-real-escape-str...
- bryanrasmussen 6y agothis code is blowing my mind - $arg = 'T'; $vehicle = ( ( $arg == 'B' ) ? 'bus' : ( $arg == 'A' ) ? 'airplane' : ( $arg == 'T' ) ? 'train' : ( $arg == 'C' ) ? 'car' : ( $arg == 'H' ) ? 'horse' : 'feet' ); echo $vehicle; can someone explain to me why it should print out 'horse'? (what the article above says) on edit: oh I get it, the false of the ternary statement here is on the left so when $arg == 'T' the true does ( $arg == 'H' ) which is false, hence printing out horse. Well there's no reason true has to come first, but it is a c-flavored language so sort of weird it doesn't.
- Aeolun 6y agoIn JavaScript you still have to deal with all the bad parts. That’s why we pretty much require monstrosities like babel, webpack and whatever other build tools you can imagine. If you want PHP, you install php, and you’re done.