I have done a tour of other languages since my earlier PHP days and this is emphatically true. PHP has tools, libraries, and patterns that are still somehow lacking most other places.
This was my bread and butter a few years ago. There's a lot of application level logic that can't be encoded into the library, like the authentication step with the server. So, it'll need a bunch of hooks for extension and can become complicated in a hurry.
That said, I really do like the idea of a package I could pull in that I can understand what it's doing and where to extend for my own custom logic. A lot of the existing packages hide enough details that I can't fully trust them or understand how to more deeply integrate them.
It's easy enough to do either, so I'd be inclined to do both. But, the migration pass ensures that everything is brought forward and that to can retire the old key. Part of the point of doing a rotation is to invalidate a compromised key, which you may not even know had been compromised.
Be able to put together a clean, normalized database schema. A bad schema forces the code that reads it to be awkward and needlessly complex.
Know the basic attack vectors for a Web application and common countermeasures. I don't want to see any SQL injection sites in your code and for sensitive data to be protected in case it happens anyway.
I want to at least see exposure to some frontend framework, like Vue or React. Gotta be able to be competent on the whole stack, even if someone else is an expert. Likewise, CSS needs to be written considerately. It is code that needs maintenance same as any other.
Circling back to how one of your responsibilities is to people less senior, you need to be able to communicate well, delegate responsibility, and be a part of guiding the development of these other devs.
Study constantly and --this is important to the moment at hand-- put yourself in uncomfortable circumstances where you stand to grow. Imposter syndrome is rife in our line of work. Put yourself out there and try your hardest.
I'd consider not knowing the difference between inner and outer potentially disqualifying for a senior candidate. At this career stage, you need to be able to solo projects and be able to mentor more junior developers. It would be like not knowing the difference between a CSS class and ID.
It's impossible to say without more detail, if not actively debugging next to you. Your best friends are going to be your logs. If they lack appropriate detail, consider this a call to start logging that detail. Apache should have a log detailing incoming requests. Your database should have logs on queries executed. Go diving into those and see if you can find a pattern.
It's more to manage upgrade risk. There are some big changes with each minor version from 5.4 to 5.6. After safely getting to 7.0 it gets much easier to just jump directly to the end of the 7.x series.
Always break things down into little steps where you make sure it works both before and after. This way, you immediately know exactly what the cause of each break is and keep the overall cognitive load low.
As you write tests, it may also be worthwhile to spend some time editing the code to be cleaner and more readable. I'm guessing that it's a tangled mess of logic that's poorly formatted. If so, clean it up before you go hunting through it a dozen times for various bugs.
Step it on your local machine bit by bit. Get to 5.4, make sure everything is still good. Then go to 5.5. Then 5.6. Then 7.0. Then whatever the latest in the 7.x line is. Each time there may be things that break. Read the release notes for each version to get a sense for what's changing and where that may break things.
When it works on your local, upgrade prod to that version and monitor for bugs. When it's all stable, bump to the next version on your local and start the cycle again. Somebody let this rot for several years, so it should be no surprise that you have a large clean-up job ahead of you.
I strongly recommend putting some PHPUnit tests wherever you can over critical application code. I'm sure this code has no tests and it will suck to write them, but they'll save you time when testing each incremental upgrade of PHP.
I'm a long-time PHP developer who got hired onto a Ruby shop a bit over a year ago. There's a lot to unpack here with your post.
I'd say that at a purely technical level, Ruby and PHP are roughly similar in many respects. I really miss being able to declare an interface or put in type restrictions on methods at a language level. I do like Ruby's minimal syntax for methods with no arguments and its meta-programming helpers. For example, instead of creating a boiler-plate getter and setter pair of methods I can just write attr_accessor :some_name in the class definition to generate the pair of methods. I can later replace that with more fully-formed methods if I ever need more than just a pair of dumb methods. So, less type help and more boilerplate help.
The technical difference starts to widen when we consider frameworks. Laravel descends from Rails in a lot of its patterns and ideas. Being a later iteration of the same general set of ideas, it's really a much nicer experience all around. ActiveRecord (the ORM) simply doesn't hold a candle to Eloquent and the Fluent (old proper name) query builder. I sincerely miss Laravel.
On to the social and professional angle, I've run into the same thing. I long felt as if other languages were better compensated. Looking at the numbers online from sites like GlassDoor only confirmed that suspicion for me. It's not that Ruby on Rails is well compensated. It's that PHP in any incarnation is worse compensated. The perception from the world at large seems stuck in time with PHP4. And there is unfortunately a section of the PHP community that also seems stuck in time there, still struggling to make the transition to an OO way of thinking. I think that Wordpress and other legacy PHP projects have kept people in a procedural way of thinking. But I have also noticed that developers using a Web oriented language like PHP or Ruby also tend to be better versed outside of their specific language with things like SQL, HTML, CSS, JS, HTTP, etc. because work with those languages necessarily entails "Web" development in all of its gory glory.
What keeps me moving forward isn't a devotion to any one language. I long ago learned to regard them as simply tools, even if I feel better with some tools (PHP/Laravel) than others. Where I keep myself growing and moving forward is with studying, practicing, and challenging myself at work on skills that transcend any particular language or ecosystem. To be clear, it's essential to be well-versed in some language and its ecosystem to be effective at writing code. But the more I learn about patterns, protocols, algorithms, architecture, and other ways of challenging my thinking, the better I get as a developer. And the best part is that I can take that knowledge with me to whatever language I happen to work in.
I liken it as the difference between learning to write in a natural language vs learning to be a good writer. You have to know a natural language and its idioms to write well in it. But knowing additional languages doesn't mean that you're necessarily good at writing. There are too many to learn, but I'm confident that I could learn a different one if I had cause. But learning to be good at writing applies to whether I'm doing it in English, French, Spanish, or German.
Zero is falsy. Not-zero is truthy. Count returns a non-negative integer and so can be used just fine here. However, u/omerida has an even better suggestion.
I think we lost something when we stopped using phpbb.
Yes. It still powers most of the Internet.
I have done a tour of other languages since my earlier PHP days and this is emphatically true. PHP has tools, libraries, and patterns that are still somehow lacking most other places.
This was my bread and butter a few years ago. There's a lot of application level logic that can't be encoded into the library, like the authentication step with the server. So, it'll need a bunch of hooks for extension and can become complicated in a hurry.
That said, I really do like the idea of a package I could pull in that I can understand what it's doing and where to extend for my own custom logic. A lot of the existing packages hide enough details that I can't fully trust them or understand how to more deeply integrate them.
That's cool and a hard no from me.
Ordered map?
It's easy enough to do either, so I'd be inclined to do both. But, the migration pass ensures that everything is brought forward and that to can retire the old key. Part of the point of doing a rotation is to invalidate a compromised key, which you may not even know had been compromised.
It's implemented with promises, but those seem unreliable in this execution context.
This is the way.
A recursive CTE would do the trick at query time.
Read the site. It tells you.
You'll indeed loose it upon the Internet.
Ancillary to your question, but read up at https://bobby-tables.com/.
Yes.
Be able to put together a clean, normalized database schema. A bad schema forces the code that reads it to be awkward and needlessly complex.
Know the basic attack vectors for a Web application and common countermeasures. I don't want to see any SQL injection sites in your code and for sensitive data to be protected in case it happens anyway.
I want to at least see exposure to some frontend framework, like Vue or React. Gotta be able to be competent on the whole stack, even if someone else is an expert. Likewise, CSS needs to be written considerately. It is code that needs maintenance same as any other.
Circling back to how one of your responsibilities is to people less senior, you need to be able to communicate well, delegate responsibility, and be a part of guiding the development of these other devs.
Study constantly and --this is important to the moment at hand-- put yourself in uncomfortable circumstances where you stand to grow. Imposter syndrome is rife in our line of work. Put yourself out there and try your hardest.
I'd consider not knowing the difference between inner and outer potentially disqualifying for a senior candidate. At this career stage, you need to be able to solo projects and be able to mentor more junior developers. It would be like not knowing the difference between a CSS class and ID.
https://vpsie.com/knowledge-base/where-to-find-cpanel-whm-logs-for-apache-email-ftp-mysql-errors/
In particular, look at "Web site access logs". See if that file is as busy as your database use.
It's impossible to say without more detail, if not actively debugging next to you. Your best friends are going to be your logs. If they lack appropriate detail, consider this a call to start logging that detail. Apache should have a log detailing incoming requests. Your database should have logs on queries executed. Go diving into those and see if you can find a pattern.
It's more to manage upgrade risk. There are some big changes with each minor version from 5.4 to 5.6. After safely getting to 7.0 it gets much easier to just jump directly to the end of the 7.x series.
Always break things down into little steps where you make sure it works both before and after. This way, you immediately know exactly what the cause of each break is and keep the overall cognitive load low.
As you write tests, it may also be worthwhile to spend some time editing the code to be cleaner and more readable. I'm guessing that it's a tangled mess of logic that's poorly formatted. If so, clean it up before you go hunting through it a dozen times for various bugs.
Step it on your local machine bit by bit. Get to 5.4, make sure everything is still good. Then go to 5.5. Then 5.6. Then 7.0. Then whatever the latest in the 7.x line is. Each time there may be things that break. Read the release notes for each version to get a sense for what's changing and where that may break things.
When it works on your local, upgrade prod to that version and monitor for bugs. When it's all stable, bump to the next version on your local and start the cycle again. Somebody let this rot for several years, so it should be no surprise that you have a large clean-up job ahead of you.
I strongly recommend putting some PHPUnit tests wherever you can over critical application code. I'm sure this code has no tests and it will suck to write them, but they'll save you time when testing each incremental upgrade of PHP.
I'm a long-time PHP developer who got hired onto a Ruby shop a bit over a year ago. There's a lot to unpack here with your post.
I'd say that at a purely technical level, Ruby and PHP are roughly similar in many respects. I really miss being able to declare an
interfaceor put in type restrictions on methods at a language level. I do like Ruby's minimal syntax for methods with no arguments and its meta-programming helpers. For example, instead of creating a boiler-plate getter and setter pair of methods I can just writeattr_accessor :some_namein the class definition to generate the pair of methods. I can later replace that with more fully-formed methods if I ever need more than just a pair of dumb methods. So, less type help and more boilerplate help.The technical difference starts to widen when we consider frameworks. Laravel descends from Rails in a lot of its patterns and ideas. Being a later iteration of the same general set of ideas, it's really a much nicer experience all around. ActiveRecord (the ORM) simply doesn't hold a candle to Eloquent and the Fluent (old proper name) query builder. I sincerely miss Laravel.
On to the social and professional angle, I've run into the same thing. I long felt as if other languages were better compensated. Looking at the numbers online from sites like GlassDoor only confirmed that suspicion for me. It's not that Ruby on Rails is well compensated. It's that PHP in any incarnation is worse compensated. The perception from the world at large seems stuck in time with PHP4. And there is unfortunately a section of the PHP community that also seems stuck in time there, still struggling to make the transition to an OO way of thinking. I think that Wordpress and other legacy PHP projects have kept people in a procedural way of thinking. But I have also noticed that developers using a Web oriented language like PHP or Ruby also tend to be better versed outside of their specific language with things like SQL, HTML, CSS, JS, HTTP, etc. because work with those languages necessarily entails "Web" development in all of its gory glory.
What keeps me moving forward isn't a devotion to any one language. I long ago learned to regard them as simply tools, even if I feel better with some tools (PHP/Laravel) than others. Where I keep myself growing and moving forward is with studying, practicing, and challenging myself at work on skills that transcend any particular language or ecosystem. To be clear, it's essential to be well-versed in some language and its ecosystem to be effective at writing code. But the more I learn about patterns, protocols, algorithms, architecture, and other ways of challenging my thinking, the better I get as a developer. And the best part is that I can take that knowledge with me to whatever language I happen to work in.
I liken it as the difference between learning to write in a natural language vs learning to be a good writer. You have to know a natural language and its idioms to write well in it. But knowing additional languages doesn't mean that you're necessarily good at writing. There are too many to learn, but I'm confident that I could learn a different one if I had cause. But learning to be good at writing applies to whether I'm doing it in English, French, Spanish, or German.
Zero is falsy. Not-zero is truthy. Count returns a non-negative integer and so can be used just fine here. However, u/omerida has an even better suggestion.
Even better. It reads more like what the intention is.
Neither. Use proper white-space after the
ifand lean on the language's type juggling:if (!count($users))