Register now or log in to join your professional community.
Python is a very powerful scripting language, it is the language used by google. The disadvantage (or some people think its an advantage) is that python is very strict with indentation. This forces you to have a clean tidy code.
However with PHP indentation is not a MUST.
In terms of language power, they can't be compared to each other because both languages are powerful in their own way.
I would prefer PHP over Python for Web development.
Because, PHP is now one of the most used programming languages with a strong community, strong frameworks (including Laravel, Kohana, CakePHP, Symfony, etc) and platforms (including WordPress, Drupal, Magento, etc).
python becouse it is high level language and fast more than php
Comparing PHP with any other language for non-Web applications does not make much sense because you rarely see PHP being used for non-Web purposes.
For instance, executing a database query in PHP or Python, should not be slower nor faster than any other language. It is up to the database server.
In real world Web applications most of the time scripts are waiting for I/O operations, like receiving and sending HTTP requests and responses, accessing
databases, accessing files, etc.. Therefore often it does not matter what is the fastest language because the time that the scripts wait for I/O operations depends solely on external systems.
Other than that, both (the original) PHP and Python implementations come with extensions written in C/C++ code, so comparing the speed of PHP and Python is just comparing how fast the commands that access that C/C++ code run. So you are not really comparing PHP and Python.
Nowadays the performance of the languages doing CPU intensive tasks should not be your parameter of decision of what is the best language for Web applications.
python , its mo redable and wide range in use
PHP is have strong grip rather than pthon
As a web developer, I like to for python. Because in future I am interested in Data science so like to prefer python and no doubt the future decade belongs to python.
i will try to learn pyton if because i am php developer. php is language in which we develope websites while is general purpose language i can do more with python as compared to php
Python is better than Php because it is more fun with beginner's mistakes. It is easier to learn and you often need less knowledge to come to about the same result. Developing with Python is supposed to be faster. Python also has some very efficient libraries for calculating and calculating on large databases. Python is also very loved by the mathematicians.
Both Python and PHP are immensely popular worldwide.
These languages have their own advantages and disadvantages, besides some distinctive features. However, in the recent past, an increasing number of people have switched to Python from PHP, owing to several benefits that the Python programming language provides.
Selecting Python in place of PHP is not very simple, but there are a number of reasons which a programmer should keep in mind while making a decision.
Here we are going to compare Python and PHP to help you decide as to which will suit your requirements better.
Why is Python preferable to PHP?The following are a few of the relevant reasons:
1. Python is better designed than PHP – PHP is not elegant as a language, although it is completely workable. That is not much of a problem in the short- to mid-term. Any developer who has a fair amount of experience in creating great software is likely to write good software in PHP. However, there are certain limitations.
To start with, PHP has certain idiosyncrasies that are weird. Beyond that, there are many things that are more nuanced and deeper.
From the point of view of a developer who is trained classically, Python gets a lot of things right in terms of being a programming language. This has much to do with the way in which reflection is implemented and functions are treated as first-class objects. There are many other things, many of which may appear to be of little consequence, which comes together to help create code that is more elegant.
You will find it much easier to use Python to write great code, although it is not impossible to write good code in PHP.
Python has architecture that helps make it a well thought out, well designed and robust language. PHP, on the other hand, seems not to be so well thought out.
2. PHP has a short learning curve but it is Python which is better in the long-term – If you are a developer, you should consider what is likely to create the maximum value for you in the long term.
For instance, PHP has a rather low learning curve and is very easy to get started with. Working with it is fun and easy and you are likely to feel very productive.
However, once you are through with that initial phase, you have to think about the future. You would obviously want to work with a language with which you can form a deep, rich and long-lasting relationship. In terms of that, Python fits the bill much better than PHP.
3. Python has a better web framework than PHP – Although conceptually developers would like to have choices, practically they like standards. If everything else is the same, they prefer that everyone works with the same libraries and frameworks. Python provides that mainly with Django, which is generally the de facto web framework choice in Python. Compared to that, PHP has Kohana, Symfony, CodeIgnitor and Zend.
In a way, competition is good. All of them are probably great frameworks, but since none stands out as a clear winner and the market is fragmented. Obviously, fragmentation is not good. It is particularly not good when it is associated with web frameworks.
The learning curve these days is more closely related to frameworks than languages. The richer and deeper the framework, the more you have to learn. There is an upfront cost for frameworks, but it translates into a lot of long-term value.
However, if there are a number of platforms going around, the chances for any person using the same framework as you are lower. So, bringing someone new up to date takes longer.
As far as Python is considered, Django is the clear winner among web frameworks. So, if you bring an additional Python developer aboard, he or she is likely to have used Django before, making things easier for you.
4. Python is more readable than PHP – PHP is extensively documented and follows a classic approach. On the other hand Python makes use of indentation enforcements that are quite strict. Arguably, Python is not just more readable than PHP, but is more readable than most other programming languages.
5. Python has a simpler syntax – This may be because the syntax is simpler and the code easier to understand and write in Python. Another reason may be that when you write something in Python it is so elegant that you want to show it to others. That is generally not the case with something that you write in PHP.
6. Python offers simpler debugging tools which are available easily – Python has a big developer ecosystem and debugging tools for the language are available easily. Utilizing these tools is quite simple and you can take advantage of these without much of a hassle.
You require several such tools in PHP, whereas fewer are required for Python. The debugging tools you get in the Python downloader package are quite sufficient most of the time.
7. Package management is better in Python – Package management acts as glue between various projects. With its help, you can write, build and share packages in such a format that other developers can easily plug into other applications.
Package management is there in PHP, but there probably aren’t any code bases using it to the extent that PIP (a tool for installation and management of Python packages) does. It enables you to install, uninstall, upgrade and use a broad range of sources for internal and external libraries.
It is rare to find a list of all third-party libraries and the version numbers in use written in one file.
8. Evented codebases are available in Python – It is difficult to find anything in the evented space in PHP. Node.js does a good job in this field, but Redis bindings for Tornado and Tornado’s asynchronous HTTP client can help build low line count and low latency backends in Python, which function in an asynchronous fashion.
Using Python, you can build backends that perform authentication, query millions of rows in Solr and return JSON in a few milliseconds.
9. The Lambdas provided by Python offer an advantage over PHP – A Lambda is a subroutine or a function that is defined and called without it being bound to any identifier. It is a code block that can be passed around and executed later, once or several times.
The Lambdas flow freely within Python and are simple to create. So, developers like to use Lambdas when these are appropriate for the job. Until recently, there was only the ‘create_function’ available in PHP, which was not really a substitute for the Lambdas in Python. There have been changes made in subsequent versions of PHP and closure support is now available. However, many developers have been avoiding switching over for several years now.
10. Python is more ‘general purpose’ than PHP – PHP generally seems like it is more suitable for the creation of web pages. In contrast, Python is more of a general purpose language. In Python, you only have to select a simple web framework that provides the functionality that you require.
I'll go for the Python, because it's new and advanced high level language as compare to PHP.