- Instructor: Yeonshil Park
- Lectures: 9
- Students: 1608
- Duration: 10 weeks
PHP can generate dynamic page content. It can create, open, read, write, delete and close files on the server. PHP can collect form data, send and receive cookies as well as add, delete or modify data in your database. PHP can be used to control user-access or encrypt data. With PHP you are not limited to output HTML. You can output images, PDF files and many more. You can also output any text such as XHTML and XML.
Academy Europe presents high-quality formal diplomas, certificates and e-certificates which are formal proof and recognition of accredited online courses. It shows all student’s abilities to learn and achieve high results and is very useful to promote personal career including with CVs, job applications and self improvements.
How can you get your certificate at Academy Europe?
- You must click “complete” link at the end of every lesson of your course after you finish them.
- When you finish all lessons of course, the “finish course” link is going to be active at the end of last lesson.
- When you click the “finish course” link, you will finish your course on Academy Europe officially. Then, “certificate” page of you completed course will be automatically active.
- You can see and download your certificate online after you click on your “certificate” link.
Samples: Horizantal Diploma – Horizantal Certificate – Vertical E-Certificate
Basic Requirements to Work on PHP
To start using PHP, you need to install a virtual web server XAMPP on your own PC. The project directory must be inside the htdocs folder of XAMPP to be loaded in browser. The files must have the exension .php
HTML markups are well supported by php. Infact, also generates html codes into html markups. Php files can’t be opened in browser directly like html files. Instead, you need to open the browser and call the local server in url followed by your project directly. If your apache server is running on port 80, then you can type
Else, you need to call the port number as well.
In order to open the php files, you need to initiate the XAMPP application and start the apache server. While you are working with database, you need to start the MySQL as well to connect to thedatabase.
While working with css in HTML files, we need to wrap css codes with <style> </style> and <script> </script> for js codes, php script starts with <?php and ends with ?>. <? ?> is also supported but needs a bit of configuration in apache server and won’t support in other computers if the configuration is not modified in that one. If no html markups are present in the page closing php tag ?> is not needed.
Printing on PHP
echo is the command to print characters in php.
<?php echo "My first PHP script!"; ?>
My first PHP script!
We can’t print the characters directly with php echo command. The characters need to be wrapped up with double quotes to make it string and the command must end with a semicolon;
Let’s see a php function too then.
Function is very important in php. All functions have their own specific tasks. As we progress to objected oriented php, all the php codes are executed in functions to keep the view files clean and the project documents well organized. php functions don’t need double quotes.
It’s an inbuilt function. This phpversion() function displays the php version being run on the computer.
This function doesn’t require echo command and provides extended details about the php version, operating system, server, configuration settings, environment settings, upload limits, and much more. Execution of any of these php commands also indicates that php is successfully running in our computer.
Echo vs Print
echo ('hello world'); print ('hello world');
Both print functions are valid. In order to keep consistency in script, it’s better to choose only one of them across a project. Echo has a merit over print though as echo allows us to print multiple strings with a single command while print doesn’t. So, echo command is preferred by developers round the world.
supported – echo (‘hello’,’world’,’check’);
unsupported – print (‘hello’,’world’,’check’);
It’s a debugging tool for developers. It allows us to check the type and value of data before adding more executable functions related to the data.
it’s also a debugging tool that displays array data. These tools are very important and are used extensively in the development environment.
PHP supports several ways of commenting.
<?php // This is a single-line comment # This is also a single-line comment /* This is a multiple-lines comment block that spans over multiple lines */ // You can also use comments to leave out parts of a code line $x = 5 /* + 15 */ + 5; echo $x; ?>
In PHP, all keywords such as if, else, while, echo, etc. along with classes, functions and user-defined functions are NOT case-sensitive but all variable names are case-sensitive.
<?php $color = "red"; Echo "My car is " . $color . " "; echO "My house is " . $COLOR . " "; ?>
In the above example, Echo and echO keywords work the same but the variables color and COLOR are seen as different values.
In this section we'll show you how this course has been structured and how to get the most out of it. We'll also show you how to solve the exercises and submit quizzes.
Completion of Course