Live data from Hacker News

Learn PHP the Right Way

github.com

21–30 of 73 posts

Re: Learn PHP the Right Way

#21
post #11

Earlier quoted context omitted.

Wow using a 12 year old obsolete article to prove a point, nice. Lets be honest here, the modern web is an over engineered fractal of bad design.

An article is not obsolete just because it's 12 years old. Honestly, in PHP's case, I don't think there's much you can say about it 12 years ago that isn't still true.

12 years ago (2012), the latest PHP version was 5.4. The current version is 8.4.

The language has made major changes to both syntax and functionality.

Re: Learn PHP the Right Way

#22
post #9
post #3

The only reason to learn PHP in 2024 is if you are specifically targeting PHP jobs. Learning PHP is like learning Perl: suboptimal. Edit: Jesu X. Chris, I didn’t mean to start a language war. Learn PHP if you want, I won’t stop you lol

PHP is so much nicer to use on a webserver vs Python or JS. It’s almost like PHP was built for the web and fits it like a tailored suit! Would I use PHP to make games? No! I wouldn’t use JS or Python for that either. I try to use the best language for the job without letting any cargo cult biases get in the way. Front end stuff? JS! Backend stuff? PHP! AI stuff? Python! Games and microcontrollers? C/C++!

> PHP is so much nicer to use on a webserver vs Python or JS.

How?

Re: Learn PHP the Right Way

#23
post #11

Earlier quoted context omitted.

Wow using a 12 year old obsolete article to prove a point, nice. Lets be honest here, the modern web is an over engineered fractal of bad design.

An article is not obsolete just because it's 12 years old. Honestly, in PHP's case, I don't think there's much you can say about it 12 years ago that isn't still true.

Almost nothing in that article is true for modern versions of PHP. It's definitely obsolete.

Re: Learn PHP the Right Way

#24
post #11

Earlier quoted context omitted.

Wow using a 12 year old obsolete article to prove a point, nice. Lets be honest here, the modern web is an over engineered fractal of bad design.

An article is not obsolete just because it's 12 years old. Honestly, in PHP's case, I don't think there's much you can say about it 12 years ago that isn't still true.

> That article is not obsolete just because it's 12 years old. Honestly, in PHP's case, there's not much you can say about it 12 years ago that isn't still true.

The very first specific thing mentioned in the article is "mysql_real_escape_string".

The mysql_ extension was deprecated in PHP 5.5.0 (released on 20 June 2013) and fully removed in PHP 7.0.0 (released on 3 December 2015).

Re: Learn PHP the Right Way

#25
post #11

Earlier quoted context omitted.

Wow using a 12 year old obsolete article to prove a point, nice. Lets be honest here, the modern web is an over engineered fractal of bad design.

An article is not obsolete just because it's 12 years old. Honestly, in PHP's case, I don't think there's much you can say about it 12 years ago that isn't still true.

It's obsolete because most of it is no longer correct.

I'm not going to bother rebuting all of it, those who really want to educate themselves can use Algolia search for the link and find great comments.

But from a quick glance of the start, the article cites "mysql_real_escape_string()". That function has been deprecated 11 years ago. And removed 8 years ago.

https://www.php.net/manual/en/function.mysql-real-escape-str...

Re: Learn PHP the Right Way

#27
post #9

Earlier quoted context omitted.

PHP is so much nicer to use on a webserver vs Python or JS. It’s almost like PHP was built for the web and fits it like a tailored suit! Would I use PHP to make games? No! I wouldn’t use JS or Python for that either. I try to use the best language for the job without letting any cargo cult biases get in the way. Front end stuff? JS! Backend stuff? PHP! AI stuff? Python! Games and microcontrollers? C/C++!

> PHP is so much nicer to use on a webserver vs Python or JS. How?

One thing that I think is under-appreciated from the perspective of "getting shit done" is that the default model of PHP makes it really hard to have memory leaks that eventually crashes your app/server, as your PHP script has a defined "start" and "end" that are all within the request lifecycle.

So even if you leak horribly, thanks to Apache/Nginx/Caddy/whatever only launching your script and then your script stops running, it basically doesn't affect you at all.

Granted, this is more like a bandage, but it works out great for beginners who just want to create their own personal dynamic homepages, something PHP does great :)

Compared to Python or JS where the standard practice is creating a server that runs constantly, and if you leak memory somewhere, your application eventually crashes as you run out of memory.

Re: Learn PHP the Right Way

#28
post #9

Earlier quoted context omitted.

PHP is so much nicer to use on a webserver vs Python or JS. It’s almost like PHP was built for the web and fits it like a tailored suit! Would I use PHP to make games? No! I wouldn’t use JS or Python for that either. I try to use the best language for the job without letting any cargo cult biases get in the way. Front end stuff? JS! Backend stuff? PHP! AI stuff? Python! Games and microcontrollers? C/C++!

> PHP is so much nicer to use on a webserver vs Python or JS. How?

A lot of the vanilla inbuilt functions are very web oriented and if you like C, it feels very similar but much easier.

Re: Learn PHP the Right Way

#29
post #9
post #3

The only reason to learn PHP in 2024 is if you are specifically targeting PHP jobs. Learning PHP is like learning Perl: suboptimal. Edit: Jesu X. Chris, I didn’t mean to start a language war. Learn PHP if you want, I won’t stop you lol

PHP is so much nicer to use on a webserver vs Python or JS. It’s almost like PHP was built for the web and fits it like a tailored suit! Would I use PHP to make games? No! I wouldn’t use JS or Python for that either. I try to use the best language for the job without letting any cargo cult biases get in the way. Front end stuff? JS! Backend stuff? PHP! AI stuff? Python! Games and microcontrollers? C/C++!

Is it really that good for backend?

1. You will still need to learn JS, and now it may even be embedded in PHP depending on the type of app you are working with!

2. It still has horrible conventions, arrays being sorted maps has to be one of the worst design decisions, IMO its worse than having null and undefined as types. Mutlibyte strings are still an afterthought in the core of PHP. Inconsistent function naming. It's new typing system is plain worse than TS in every way. Async programming is still terrible. Needle Haystack swapparoos throughout the language.

3. It was built for the web as it stood 20 years ago, HTML embedded in code, single server sessions, cgi servers, and minimal latency server to server communication. It cannot feel more out of place today.

I will give it: Laravel is a robust framework that helps hide some of this, but its hard to hide most of it.

Re: Learn PHP the Right Way

#30
post #13
post #10

Earlier quoted context omitted.

Please give me some examples!

Learn a functional language like Elixir. That’ll prove both useful and mind expanding!

How can I use Elixir for the web, microcontrollers or making games?

How can Elixir make the development of those things easier/better?

Post reply on HN