w3resource

PHP Exercises, Practice, Solution

What is PHP?

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

The best way we learn anything is by practice and exercise questions. We have started this section for those (beginner to intermediate) who are familiar with PHP.

Hope, these exercises help you to improve your PHP coding skills. Currently, following sections are available, we are working hard to add more exercises. Happy Coding!

Note: It's fine if you are playing around with PHP codes with the help of an online PHP editor, to enjoy a full-fledged PHP environment (since online editors have several caveats, e.g. embedding PHP within HTML) up and running on your own machine is much better of an option to learn PHP. Please read our installing PHP on Windows and Linux if you are unfamiliar to PHP installation.

List of PHP Exercises :

PHP Challenges :

Note : You may accomplish the same task (solution of the exercises) in various ways, therefore the ways described here are not the only ways to do stuff. Rather, it would be great, if this helps you anyway to choose your own methods.

Popularity of Programming Language
Worldwide, December 2019 compared to a year ago:

Rank Change Language Share Trend
1 Python 29.71 % +4.1 %
2 Java 19.29 % -2.2 %
3 Javascript 8.33 % +0.0 %
4 C# 7.27% -0.4 %
5 PHP 6.32 % -1.0 %
6 C/C++ 6.0 % -0.3 %
7 R 3.79 % -0.2 %
8 Objective-C 2.61% -0.6 %
9 Swift 2.5 % -0.1 %
10 Matlab 1.84 % -0.2 %
11 TypeScript 1.81 % +0.2 %
12 up arrow Kotlin 1.63 % +0.5 %
13 VBA 1.37 % -0.1 %
14down arrow Ruby 1.35 % -0.2 %
15 up arrow Go 1.32 % +0.3 %
16 down arrow Scala 1.16 % -0.0 %
17 down arrow Visual Basic 0.98 % -0.2 %
18up arrow Rust 0.63 % +0.2 %
19 down arrow Perl 0.51 % -0.1 %
20 up arrow Dart 0.39 % +0.2 %
21 down arrow Lua 0.36 % -0.0 %
22 down arrow Haskell 0.29 % -0.0 %
23 down arrow Julia 0.28 % +0.0 %
24 down arrow Delphi 0.23 % -0.0 %

Source : http://pypl.github.io/PYPL.html

TIOBE Index for November 2019

Nov 2019 Nov 2018 Change Programming Language Ratings Change
1 1 Java 16.246% -0.50%
2 2 C 16.037% +1.64%
3 4 up arrow Python 9.842% +2.16%
4 3 down arrow C++ 5.605% -2.68%
5 6 up arrow C# 4.316% +0.36%
6 5 down arrow Visual Basic .NET 4.229% -2.26%
7 7 JavaScript 1.929% -0.73%
8 8 PHP 1.720% -0.66%
9 9 SQL 1.690% -0.15%
10 12 up arrow Swift 1.653% +0.20%
11 16 up arrow Ruby 1.261% +0.17%
12 11 down arrow Objective-C 1.195% -0.28%
13 13 Delphi/Object Pascal 1.142% -0.28%
14 25 up arrow Groovy 1.099% +0.50%
15 15 Assembly language 1.022% -0.09%
16 14 down arrow R 0.980% -0.43%
17 20 up arrow Visual Basic 0.957% +0.10%
18 23 up arrow D 0.927% +0.25%
19 17 down arrow MATLAB 0.890% -0.14%
20 10 down arrow Go 0.853% -0.64%

Source : https://www.tiobe.com/tiobe-index/

List of Exercises with Solutions :

[ Want to contribute to PHP exercises? Send your code (attached with a .zip file) to us at w3resource[at]yahoo[dot]com. Please avoid copyrighted materials.]

List of Exercises with Solutions :



Inviting useful, relevant, well-written and unique guest posts