Just as the French, Spanish and Chinese languages are uniquely different, programming languages also have their various variations, some more popular and easier to learn and use than others. With the recent introduction of some new ones, there is a complete ‘war’ of modern day languages.
PHP vs Python vs Ruby
What’s easier and faster to use is not always the best option.
Below we highlight three of today’s most popular programming languages. Whether you’re looking to learn PHP, grab that hot new Python class, or finally learn Ruby and conquer Rails, this comparision helps you differentiate, who uses them, and their popularity.
PHP: Most Popular Scripting Language for the Web
PHP (Hypertext PreProcessor) is a server scripting language designed by Rasmus Lerdorf, a powerful tool to create dynamic and interactive websites. It is fast, flexible, widely-used scripting language for everything from a simple blog to the most popular and dynamic websites in the world.
Advantages of PHP
- Free software released under the PHP license
- Easy to learn (Short learning curve)
- Large community of users and developers
- Provides extensive database support
- Offers great number of available extensions and source codes
- Allows execution of code in restricted environments
- Offers native session management and extension API
- A great alternative for competitors like Microsoft’s ASP (Active Server Pages)
- Can be deployed on most web servers
- Works on almost every operating system and platform
Disadvantages of PHP
- Not suitable for making desktop applications
- Error handling is traditionally poor
- Global configuration parameters can change language semantics, complicating deployment and portability
- Objects are CallByValue by default, which is the opposite of most languages and catches lots of programmers off-guard
- Generally considered to be less secured than the other programming languages
Who Uses PHP?
Popularity
According to Wikipedia, as of January 2015, PHP was installed on more than 342 million websites (47% of those sampled) and 2.8 million web servers.
Syntax
A PHP script starts with < ?php and ends with ?> The default file extension for PHP files is “.php”. A PHP file usually contains HTML tags, and some PHP scripting code.
&amp;lt;?php // PHP code goes here ?&amp;gt;
Python: General Purpose Programming Language
Python is a widely-used high level (but it also used in a wide range of non-scripting language) design for programmers to express concepts with fewer lines of code. It was conceived in the late 1980s and was implemented by Guido van Rossum.
Python code resembles the pseudo-code just like all the scripting languages. The elegant design and syntax rules of this programming language make it quite readable even among the multi-programmer development teams. It supports multiple ways of building the structure and elements of computer programs, including object-oriented and functional programming
Advantages of Python
- Easy and quick to learn
- Runs in multiple systems and platforms
- Readable and organized syntax
- Offers rapid prototyping and dynamic semantics capabilities
- Great community support
- Easily construct applications by testing and importing crucial functions
- Reusability through carefully implementing packages and modules
- Object Oriented Programming-driven
Disadvantages of Python
- It doesn’t really do multi-processor/multi-core work very well
- Smaller pool of Python developers compared to other languages, such as Java
- Absence of a commercial support point, even for an Open Source project (though this situation is changing)
- Database access layer limitations
- Reputed to be slower than languages such as Java
Who uses Python?
- Yahoo Map
- Zope Corporation
- Linux Weekly News
- Shopzilla
- Ultraseek
Popularity
According to Wikipedia, since 2008, Python has consistently ranked in the top eight most popular programming languages as measured by the TIOBE Programming Community Index. It is the third most popular language whose grammatical syntax is not predominantly based on C, e.g. C++, C#, Objective-C, Java.
Syntax
Invoking the interpreter without passing a script file as a parameter brings up the following prompt:
$ python Python 2.4.3 (#1, Nov 11 2010, 13:34:43) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 Type &amp;amp;quot;help&amp;amp;quot;, &amp;amp;quot;copyright& amp;amp;quot;, &amp;amp;quot;credits&amp;amp;quot; or &amp;amp;quot; license&amp;amp;quot; for more information. &amp;amp;gt;&amp;amp;gt;&amp;amp;gt;
Typing the some text to the right of the Python prompt and press the Enter key will output the text:
&amp;amp;gt;&amp;amp;gt;&amp;amp;gt;print &amp;amp;quot; Put some text here!&amp;amp;quot;;
Job Demand
Based on Jobs Tractor which analyzed more than 45,000 developer jobs advertised on Twitter during the past 12 months, the results are the following:
- PHP – 8,238
- Ruby – 2,937
- Python – 1,587
Although PHP still has the higher statistics on this site, remember not to use statistics as the basis for learning or using a programming language.
Ruby: Interpreted, Pure Object-Oriented Programming Language
Ruby (programming language) runs with Ruby on Rails or simply rails, an open source, full-stack web application framework. It is a dynamic, imperative object-oriented programming language developed by Yukihiro Matsumoto in Japan. It was influenced by Perl, Eiffel and Smalltalk. It a has dynamic type system and automatic memory management.
Advantages of Ruby
- Open-sourced
- Works on multiple platforms
- Can be embedded into Hypertext Markup Language (HTML)
- A Very High-Level Language (VHLL)
- Offers encapsulation of data methods within objects
- Pure OOP (Object-Oriented Programming)
- Super advanced string and text manipulation techniques
- Can easily be connected to DB2, MySQL, Oracle, and Sybase
- Scalable and big programs written in Ruby are easily maintainable
- Has a clean and easy syntax that allows the new developer to learn Ruby very quickly and easily
- Ability to write multi-threaded applications with a simple API
- Offers advanced array class
- Able to write external libraries in Ruby or C
- Allows “reserved word” to be used as an identifier as long as the parser doesn’t perceive an ambiguity
- Better security features
- It has a debugger
- It has flexible syntax
- Powerful string handling
Disadvantages of Ruby
- Learning it can be difficult
- Lacks informational resources
- Slower processing time (CPU time) compared to other programming languages
- Development and updates are slower
Who uses Ruby?
Popularity
According to the Ruby website, it is ranked among the top 10 on most popular programming languages worldwide (such as the TIOBE index). Much of the growth is attributed to the popularity of software written in Ruby, particularly the Ruby on Rails web framework.
Syntax
All Ruby files will have extension “.rb.” Using the Ruby interpreter available in /usr/bin directory, you can run Ruby codes.
#!/usr/bin/ruby -w puts &amp;quot;Put something here&amp;quot;;
Hope this helped clearing some doubts about the three languages.
~ News4masses is now also on Google news
~ If you want to contribute an article / story, please get in touch at: news4masses[at]gmail[dot]com