Perl, PHP, Python

About 15 years ago, I wrote pages for a website which collected and presented stats from BOINC projects. I wrote these in perl. I am now to do stats pages for another site and considering options. perl is old, I initially thought I’d do it with PHP, I’ve never used it, but it looks C++ like so doubt I’d have much trouble. I was then told that python might be a better choice. The forum poster did not give me any reason for this, but hey, I’m flexible. So the question is, should I continue by learning PHP, which appears quite C++ like, or should I learn python? I have programmed in several languages, C++, Fortran, Pascal to name but a few. Over to you…

Python is one of the most popular programming language out there, it is number 2 on the TIOBE index (and real close to be number 1, as of June 2021) so personally I think it is a valuable language to learn as it can open you up to various opportunities and jobs requiring Python skill.

I think it depends a lot on personal choice, and what you’re trying to accomplish. If I were in your position, and having to choose between one language (or library) vs another, here are some of the things I’d consider before making decision:

  • availability of good documentation and open source communities
  • actively maintained, so I could upgrade and receive bugfixes in the future
  • popularity, for various reasons, like, how easy would it be for me to get help with it? are there folks in forums / stackoverflow answering questions if I were to get stuck? can someone else take on this project in the future so I could take vacation/take on new projects?
  • what am I building? Can the language/library actually do this?
  • etc

Hope this helps.

If you haven’t advanced too much in php, I would recommend you to python. If you already have some proficiency, learn first php well. The situation with python is that is very used. In developers python and java script are popular, in data science, you have python and R.
In addition to these,there are many alternatives.
Just be sure not to choose a very unpopular one.
Regarding Fortran and Pascal, these are examples of “impopular” languages, no matter if the reason is the “age” or simply the small niche or community, a less used language, have less opportunities
Hope this helps.

Can Python code go directly into the html files like PHP, ie, it is interpreted at display time?

The answer to your question is no and yes.

The answer here is no. Python is not a web site creation language but a scripting language that has evolved into a general purpose programming language. To create a web application using Python you will use a web framework (Django, Flask, Bottle, etc.). These help you organize the communication with the browser or other web enabled applications. Than you use a templating language to create your web pages. Django comes with its own templating language, examples of other languages are Jinja2 (comes with Flask, but is a separate project) and Mako.

Of course. How else could you react to the input of a user? Also the templates can contain some logic of the type “if we get passed the email address, show it here”; using that to do complex programming is frowned upon, do that in Python.

Hi Adrian,

is there a reason why you do not consider to learn JavaScript? For Web Development maybe the number one…

Cheers, Dominik

I’d recommend Python as well. PHP used to be my favourite language until I glanced back to a project I’d done a couple of years earlier… and couldn’t make heads nor tails of it. Mind you, when writing that code, I wasn’t thinking of readability, but it was all written as strict OOP code, very modular, as loosely-coupled as possible, etc. etc. so it shouldn’t have been that hard to figure out.

I’ve never had that happen with a Python project.

There are some things I seriously love about PHP, though… like every variable starting with ‘$’ makes them jump off the page (syntax highlighting-wise) and it being a curly brace language, but…

Python’s got that strict indentation policy…

Anyway, there you go, some tidbits to mull over. Hope it’s helpful.

For web backends, Python might be fine. For web frontends it is not the preferred language, if you ask me.

Whether you choose PHP or JavaScript also is a question, whether your task should be done server-side or client(browser)-side.

Server side: PHP might be the right choice, client side: JavaScript might be the right choice.

But others might be more competent to answer this question. My web development experience is quite limited.

Cheers, Dominik

PS: with Pyodide things might change in the future…