Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
devTea97539dBoth of them serves different purposes, what do you want to focus on? Frontend or backend? Although js can serves backend too, I still prefer those solid backend language for the job.
It depends what your ultimate end goal is.
If you want to develop web applications, JS is applicable across all platforms, so it would be useful regardless of whether you learn PHP.
If you learn PHP first, you will limit yourself as the vast majority of PHP applications work in conjunction with front end logic written in JS.
To be honest, if your end game is to develop for the web, you would be best learning them both simultaneously as developing for the web can be done in pretty much just those two languages.
What I would suggest is that you also learn some C or Java. Neither JS not PHP will encourage good coding style. They're both too flexible and don't enforce a "correct" way to structure your code. Neither are truly object oriented, so leaning a compiled language would be useful.
Personally, I'd go with Java over C. It's easier to learn the basics of OO in Java, and it would add something to your other options.
@oudalally PHP does have namespaces, just not overly common to come across in everyday use.
your not wrong about it not encouraging good coding behaviour though.
@Ganofins as stated before, which side of the development do you want to focus on? if its just to build a dynamic website, then learn both together, the interchanging between languages becomes easier as you go, i currently jump between PHP, JS, Java and Python on a daily basis.
@C0D4 Ahh, thats quite interesting to know. The issue with PHP is that it had such little direction from the outset that loads of legacy code is in the world that will NEVER be updated to use any new additions, so nothing can ever be truly deprecated.
With so much legacy code, people learning the language now have more resources available to learn the PHP way to do things rather than an OO approach which can be easily transferred to other languages.
That's not to say it's bad, it's just not consistent, and a lot of PHP developers spend more time learning the quirks of the language rather than learning transferable skills.
Of all the languages I've learned, I think C# is the most useful instructional language, although Java is more flexible in terms of cross platform compatibility and real work use cases. It's too verbose though. I hate writing get/set methods now I'm so used to public properties!
@oudalally yea i agree, I think the main thing holding PHP back is the amount of backwards compatibility the language supports. I get it’s hard to move forward with millions of projects using the language, but taking years to deprecate features doesn’t help either, unless you have a lagacy monolithic beast that’s more practical to leave running on outdate versions then to rebuild to be able to migrate to a new version, but then that should be upto the sysadmin to keep running rather then the language it’s self.
y not do it simultanously? php functions being called by a html/js ajax frontend... its the real deal, instant satisfaction and you can automate things ull use in everyday life, more fun... more learning
@C0D4 It's the issue surrounding any language which has a big supporting infrastructure.
With Java, you can install a JVM and run your software. If you build a web app in Java, just run up a Tomcat or Glassfish instance, and deploy the WAR file.
For a PHP application, you need apache, all the right modules, the right PHP version compiled with the right flags set, and you need to provide all sorts of environment variables and supporting file system locations to handle errors.
It's the same reason I don't like node. You have to do so much work to make sure the environment is set up properly to make it work. I've always liked languages that put those details into the hands of the developer such that you can package a complete solution which can configure and install itself.
Trying to achieve something self configuring and self installing in PHP still requires a lot of pre-configuration work before you can get anywhere with it.
@oudalally WAMP, LAMP... really lots of few-click-installers wich dont require u know all of the aspects before u can start coding locally
btw: lamp, wamp a'd alike a installers (packages) that include everything u need including the right configuration for local development, apache, php, mysql, ssl functionality etc....
At least these arent easy to google questions
@BadCompany True, there are some excellent local development stacks to get started with, but at some point, you can't escape learning how the environment works if you want to properly understand how it works.
Suppose you use a self contained LAMP stack, then want to install on a Debian server. You learn the structure of the Debian LAMP install, and all is good.
Then, some months down the line, you want to install on RHEL. Everything is in a different place, the configuration is different and you have to learn that too.
Then, one day you're asked to install on a WAMP configuration. Or you need to deploy on NGINX, or IIS.
There's so much outside of the language that is needed to support your application that can be outside of your control.
With a Java web app, if you have a container, you just deploy and set your properties. Job done.
@oudalally good point, its true, actually exactly how i learned most of it over time, the big picture, but i dont see at as a negative thing. It did deliver me some hair pulling lol..
but if he just wants to learn locally on his laptop, not talking about deploying apps or migrating databases, its doable
@oudalally multi environment setup is part of the PHP journey. I kinda like it and setting up a new environment in a different distro or even on windows sometimes is a good knowledge base to have.
Mind you windows and PHP are in no way meant for each other so I don’t suggest anyone learning how to deploy php yourself to windows in a web server capacity outside of Wamp Server or similar. Cli on the other hand - go for it!
@BadCompany It's certainly doable, and I'm not suggesting it's a a bad thing. If your intention is to be a web developer, you need to understand the environment on which your software will actually run.
The issue I have with it is that you can't really learn just a language, you have to learn it all at the same time in order to achieve anything significant, which isn't the case in a compiled language with a self contained environment.
Even developing .NET desktop applications doesn't need that much background learning, so you can focus on the code and developing the understanding of the language.
The key thing is, if you want to pick PHP or JS to focus on, you will limit what you're able to achieve as they're all part of a much larger strategy.
If you want to focus on a single language to hone your skill set, C# or Java are better for learning OO methodologies as the process is less dependent on other technologies outside the chosen language.
@C0D4 This is the problem with any language which has been so integrated with a particular toolset, especially when Linux is the main OS where it's used in bulk.
Everything in the Linux user land has tight integration. It's a core property of the structure of the platform. Even a BSD Unix environment isn't so tightly integrated.
When you translate that to another OS, fundamental problems crop up which muddy the waters even further.
That said, when you try to port a .NET application from windows to Linux, it's far from easy. Tbh, I've had more success porting C++ to linux than C# in .NET.
I think the crux of the matter is that although some 30 years ago, you learned a language and its tool set, now everything is much more integrated and that level of integration varies dependent on the platform.
It's not really accurate to consider a language as an entity in itself anymore, the entire ecosystem needed to support it has to be accounted for as well.
The language is so often and so thoroughly misunderstood that it will really pay off to learn JS first. On the one hand it'll save you a lot of time and frustration, and on the other it's the prerequisite for lots of new possibilities, such as becoming full-stack.
I wouldn't bother with PHP, though, but that's just my personal opinion, so take.it with a grain of salt.
@AlexDeLarge That's a good point, JS is one of the most flexible scripting solutions ever devised, especially when you take into account the myriad cases where it can be used.
With things like Perl and PHP, they are pretty much limited to server side work, but with the likes of Node, JS can be applied to pretty much any part of the stack.
That said, it's very easy to screw up with JS, especially when so many tutorials and resources suggest jQuery as the solution to almost everything.
Plain vanilla JS is actually pretty capable, if used carefully and I reckon that about 50% of situations where jQuery is used, plain JS would be both a faster and lighter way to implement a solution, even when working with lots of asynchronous functions.
PHP in my case because backend.
learn a sensible language first, so that when JS or PHP start to fuck you up you can at least notice it's happening
Also don't use PHP, use Ruby or Python 3, then work your way up from there.
@Ganofins It makes more sense to learn something like Python or Ruby.
Both are easier, and offer more stable + readable server-side programming than PHP does (check out Django or Ruby on Rails). You can also use Python/Ruby for automation, scripting and writing software.
I mean, learn PHP if you want; It'll get the job done. But it seems obsolete now because of so many better options.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job