Learn PHP Programming From Scratch

  • Instructor: Yeonshil Park
  • Lectures: 8
  • Students: 1513
  • Duration: 10 weeks

PHP is an acronym for “PHP: Hypertext Preprocessor”. It is a powerful server side script for creating dynamic and interactive Web pages. PHP files can contain text, HTML, CSS, JavaScript, and PHP code. PHP code are executed on the server and the result is returned to the browser as plain HTML. PHP files have extension .php

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.

Free Certification

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

localhost/yourProjectDirectoryName/yourProjectFileName/

Else, you need to call the port number as well.

localhost:portNumber/yourProjectDirectoryName/yourProjectFileName/

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.

Syntax

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!";
?>   

Result

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.

echo phpversion();

It’s an inbuilt function. This phpversion() function displays the php version being run on the computer.

php_info();

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’);

var_dump(‘hello’);

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.

print_r();

it’s also a debugging tool that displays array data. These tools are very important and are used extensively in the development environment.

Comments

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;
?>  

Case Sensitivity

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.

  • Overview 0/5

    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.

  • PHP Functions 0/3

Admin bar avatar
Yeonshil Park is an artificial intelligence instructor and course content presenter at Academy Europe. She is an expert in instructional design and teaching. She supplements her knowledge in E-learning and Educational Technology by using AI and TTS elements.

Reviews

  • Aadil khan

    Awsome

    More concepts of php should be cover atleast oops concept.
  • Satnam singh gill

    Interesting..!

    There are more contents that can be updated to this course. overall happy with what it offers..Thannks
  • Admin bar avatar

    David Lee

    Overall good

    Good one. But there's still space for improvement
  • Admin bar avatar

    Daziy Millar

    Awesome Course

    So happy with this course. Want more from this instructor

Price

Free

Rating

Average Rating4.0
5 Stars
1
4 Stars
2
3 Stars
1
2 Stars
0
1 Star
0