Which language is easier for to learn between PHP and Python? I learned and worked with both. I find Python easier to start with. What is your opinion?
I vote for Python, but this actually requires some context.
PHP stands for Hypertext Preprocessor. It was designed for the Web, but nowadays itʼs used for other things, too (although often tightly linked to a Web app.) This means unless you are a Web developer, you probably wonʼt ever consider using it.
Python started as a generic interpreted language, and as such, is more performant than PHP. You can write a lot of things in Python even if you only use the standard library.
That said, I think Python is easier as you donʼt necessarily need to install extra libraries or software just to try it (not to mention it is included in most Linux distributions so itʼs probably already on your computer/VPS).
Might sound biased since I prefer Python myself, years after PHP development. But Python is used in programming Courses around the World for beginners for a reason. The syntax is much easier to learn rather than the curly-braces driven PHP.
Examples:
Python
print('hello world')
PHP
<?php
echo('hello world')
?>
I've used both a fair bit (although PHP is quite a while ago), and Python was easier. It's much more consistent and logical, with fewer quirks that exist for historical reasons. As a bonus, it's also more general-purpose.
It might be easier to make a "hello world" website in PHP, but it only helps for the first few hours/days. Medium/long term, Python wins.
Joe Clark
Full-stack developer specializing in healthcare IT
I vote for PHP, but I'm biased. I know PHP. It was easy for me to learn since it carries many similarities with other languages I've programmed in. I don't know Python that well because I've never had a need to use it in my job. PHP was required learning. That said, I can certainly read Python, and it seems easy to me. If I were to program in Python for a year, my answer might be different.