Passively watching YouTube is probably not the right way to learn any progamming language.
Learn PHP the Right Way
31–40 of 73 posts
Re: Learn PHP the Right Way
#32Earlier quoted context omitted.
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
#33I watched it myself and learned a thing or two despite also working with PHP professionally for years.
Highly recommend to also stop after each video and try to implement a quick example of what it is teaching.
Re: Learn PHP the Right Way
#34Earlier quoted context omitted.
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-…
Re: Learn PHP the Right Way
#35Earlier 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++!
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. I…
2. I much prefer using PHP arrays than JS arrays. All the other stuff you mentioned have never been a issue for me in the past 10 years. I don’t care about types (I don’t even remember when I had a real type bug).
3. The modern web is an over engineered mess, all the modern js frameworks have made the user experience objectively worse. Oh wow your shitty website that has some text and a few pictures is taking 900mbs of ram and 70% of my cpu? Wow very modern! What progress we have made!
Re: Learn PHP the Right Way
#36The 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
I think for probably more than half of all websites out there, something like LAMP is either the optimal, or very close to the optimal solution. It's absolutely bonkers to me what kinds of tech stacks people use to render what essentially amounts to a bunch of forms.
Re: Learn PHP the Right Way
#371. Essentially an HTML document is a valid PHP program. This is an excellent starting point for beginners;
2. PHP has a stateless API that means there's basically zero start up cost, unlike, say, loading libraries like you do in Java or even Python;
3. There's no threading within the context of a request. This is what you want 99.99% of the time. Hack extended this with cooperative async/await;
4. Because of (3) everything you allocate/use within a request context just gets thrown away. There's no persistent state (eg like Java's servlet model). Again, this is almost ideal;
5. Because of all the above, PHP hosting is incredibly cheap and accessible.
The two things I'd probably add to PHP come from Hack: a modern type system with nullable support and the collections (vec, map, set).
Re: Learn PHP the Right Way
#38The 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
There's certainly a ton of use cases where php is a few minute job and anything else is 10x more or even longer just like is true with shell scripts and perl Snobbery is like saying you're intellectually superior to using a specific screwdriver or kitchen knife.
Re: Learn PHP the Right Way
#39The 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
I'd rather get paid $1,000 to build something that takes I can start a new Laravel project and with a starter kit have 50% of the site done. Auth's already done out of the box. The ecosystem is amazing. The tooling is amazing. WordPress is amazing and its ability to extend itself and build almost anything you want is amazing.
I'm moving on to the next client while someone is crying about WordPress' arcane database structure or code and they're still sitting at a text editor with some Haskell code.
All I have to do is worry about my project, not create OCD for 2 weeks on the best way to set something up out of 10 different ways.
I'm not worrying about which flavor of JavaScript framework is in popularity this week - I'm not worrying about how to deploy my Python app and setting up Kubernetes. I'm not worried about compiling my Elixir project to WASM and deploying to Fly.io to support my 1 visitor a month.
Re: Learn PHP the Right Way
#40Earlier 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++!
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. I…
I'm curious, why is that so bad? It tends to be a useful property of PHP arrays.
Also for webdevelopment, I/O is often the bottleneck. This code creates an array with 1 million items, each being 'a' and then loops over each value, changing them to 'b':
$array = array_fill(0, 1000000, 'a');
foreach ($array as $key => $value) {
$array[$key] = 'b';
}
It executes in 2ms on my machine.How often do you need to create and change each element of a million item array? A roundtrip TCP/IP call to PostgreSQL is bound to be slower than that for most web servers.