Why do backend developers have more confidence in their profession than frontend developers?

Because 99% of the time when someone identifies as a front-end developer they are saying that they have not been a developer for very long.

Think of it this way. On the web, Ajax was “invented” in 2004 (actually Outlook was doing it in 1999 but shh…we can’t give Microsoft any credit). It did not become a central part of most web developers’ lives till 2008/2009 or so. Even then, Javascript was avoided by many until frameworks started coming out in the early 2010s.

So what were people who were already established developers pre-2010 doing? Working largely on the back-end. So now that they do a lot of front-end work too, they face the choice, do they brand themselves as a “front-end” or a “full-stack” developer? I certainly choose the latter.

Which leaves most people who embrace the “front-end” moniker as people who have been coding professionally for less than six years. So yeah…they’re less sure of themselves.

For the record, I use the “front-end” and “back-end” terms above in the manner I see them used more often, with “back-end” meaning server-based languages, databases, etc; and “front-end” meaning HTML, CSS, and Javascript. Personally, I dislike those definitions and prefer “back-end developer” to indicate how good someone is at understanding architecture, performance, databases, and security; and “front-end developer” to indicate to what degree someone thinks about human-computer interaction, responsiveness, UI optimization and reusability, browsers, responsiveness, and accessibility. When you formulate definitions this way you start seeing these as two largely orthogonal dimensions of a square, rather than anything mutually exclusive.

Disclaimer: I use 99% rhetorically. It certainly is an overwhelming majority but I haven’t done any data gathering on the subject. That being said, I certainly don’t claim that front-end development is easy. There’s a huge amount of churn. There aren’t many other areas of development where people have to actually stay on top of language specs. 

If PHP “does’t scale” why use it?

I would summarize:

The main issue is that server time is cheaper than developer time.

A scripted language like PHP (or Ruby, etc.) takes about half as much time to program as bytecode or compiled language like Java (or C, C++, etc.).

So if you have a team of 10 developers each paid $100K, then you are paying out $1M in salaries. If you replace Python with Java, now you need to hire 10 more developers and pay out another $1M. In exchange for what, saving $50K of server time? Obviously, that’s not worth it!

If you already know PHP then go with it. Especially if you want to get to market as soon as possible to have an early mover advantage. Experienced PHP developers know that they could find out where to optimize once their site is in production and its features had been decided on.

This is a good example for other startups. The combination of rapid development time and flexibility on the front end and speedy service time on the backend is a good example to imitate.

As a professional PHP engineer:

The stigma that PHP applications don’t scale well comes from the fact that many inexperienced programmers choose PHP for their web applications. This is because PHP is an easy language to learn, integrates extremely well with Apache, and is supported on nearly every host in the world.

Inexperienced programmers will often use bad practices when writing code. Given enough of these bad practices littered throughout the web, written in the inexperienced programmer’s favorite language, it’s easy to see why some people are averse to PHP.

There’s also, probably, a “holier-than-thou” attitude that some programmers have toward PHP (again, because of its simplicity).

PHP scales just as well as any other language when page caching and best practices are taken into account. There are plenty of well-used PHP projects to prove it.

The easiest way to validate email addresses in PHP

php-logo

Here’s the absolute easiest way you can validate an email address using PHP. This tiny function takes advantage of the filter_var() function in PHP.

That said, you really don’t even need the function wrapper if you can remember filter_var() and the appropriate constant.

Just remember that the return value will be the filtered string or false — not always a boolean value like the function above.

To use it:

Finally, no more crazy regular expressions in your code!