I’ve purchased the Hosting services from CPWebHosting to practice PHP & MySQL and I’m quite satisfied with their monthly hosting plan. PHP is most reliable programming language and is being most popular among us beginners, who have just started learning programming language. Whatever I’m learning in the school, I’m practicing on the domain which I have got from cpwebhosting.
So, far I have learned the basics of PHP in which I’m able to create variables, logical expressions, loops and functions. I’m able to connect PHP to MySQL database and learning to create the complete application. I’m creating the application, in which I’m creating good navigation system, forms, validation in form entries and a password protected admin area.
Still my curriculum includes CRUD routines for updating the database, debugging techniques and usable user interfaces application with site navigation, form validation, and a password-protected admin area.
It is best way to practice PHP by creating the live examples and reinforce various techniques to improve the existing code.
Joomla and Drupal and tried to understand, how their programmers have done the things beautifully. I liked the user authentication system of these CMS. Let me show you how a beginner can start with PHP, let us write one short program In this program I have embedded PHP code in HTML
Here is one more program, in which I have used the control structures of PHP:
Learning Control Structures with PHP
$a = 10;
$b = 15;
if($a > $b)
echo “a is greater than b”
elseif ($a < $b)
echo “a is less than b”
echo “a is equal to b”
Let us take one more example in which I have used control structures loops:
<html lang = “en”>
Learning Control Structures with PHP
echo $count. ‘ ‘;
You see, I have embedded all the php code in HTML, that is because PHP is a scripting language, which runs on server. Thus we can say that it is server-side scripting language. Well, earlier I said, we are learning programming language, but PHP is not programming language it is scripting language. Then, how this difference comes out to be. Let us answer why, it is not programming language:
- PHP runs only in response to an event. It does not runs automatically, when the page is requested only then the PHP runs.
- Instructions are being performed from top to bottom. PHP page once requested, it loads and then runs from top to bottom.
- There is little or no-interaction with user.
While if we look into the properties of Program:
- Program runs, even when there are no events.
- Program jumps into the various sections. There can be several start and end points, or we can say that there is no clear start or end point in programming language.
- Program may include lot of user interaction. Once the applications are launched, it keeps on running, waiting for user input. Program jumps to the various instructions, according to the task you want it to perform.
But, these days, scripts are more efficient to be programs. Technically we can say that PHP is not a programming language, but the differences have become too blurred. Structures are made available in the scripts itself.
If the html code is what our browser receives, then why not to straight forwardly write the html code instead of php. The reason is that php provides greater flexibility than html. Html pages are static in nature, they remains same all the time, while PHP generates dynamic pages, which are being generated under different conditions according to the user interaction or data stored in databases. Structures of C, java, perl and PHP are very similar with very minute differences. It means learning PHP is easy and I’m lucky to star PHP with cpwebhosting.