
A brief overview of this PHP for Beginners course and an introduction to your instructor.
I will briefly introduce some of the concepts covered in the course and explain who should consider taking this course.
IMPORTANT: Please read carefully
In this lesson we look at how to set up the PHP for Beginners development environment.
You are free to use any development environment that you are already using (if any). If you are a complete beginner and not confident in setting up a server then I highly recommend following me and using the same environment I use i.e. Visual Studio Code and MAMP.
If you have never coded PHP before then you may not be aware that the code needs to be run by the server engine prior to being displayed on your browser as HTML. You therefore need to set up your server environment correctly.
Due to the huge number of possible platforms and editors I cannot offer support for third party development environments.
VISUAL STUDIO CODE AND MAMP
This option is free to use but is a local environment install. You will need to download and install Visual Studio Code and MAMP. I go through these in the video.
Visual Studio Code is a great editor to use and it can be expanded as you mature with your coding skills.
If you do not wish to use either environment then you can use any of the many alternatives available.
We follow the coding tradition and start with Hello, World!
The 'Hello, World!' script is a common starting point for most coding courses and we follow this traditional starting point in PHP for Beginners.
The actual PHP code is straightforward but we learn the basics of the code structure that can help with more advanced coding examples.
I think there is always something special about writing your first lines of code. I know when I do this in a normal classroom with students there is always a 'wow' moment as they actually create something for the first time and see the output of their coding 'skills'.
Enjoy this simple lesson and remember that it will not be long before you are writing much more complex PHP code.
Learn how to start a PHP code block and how to avoid and handle some basic common errors.
The fundamentals of any good piece of PHP code starts with an understanding of the basics. In this lesson we will look at how we start a PHP code block by opening a PHP tag and when it is OK to omit the closing PHP tag. You would be amazed at how many coders are caught out by this very simple error.
Most of the errors beginner PHP coders encounter come from missing semi-colons on the end of each line. Those of you who come from a language where line terminators are not required will need to ensure that you finish each line with a semi-colon.
The error messages you receive in your browser are a great way to help you identify where your error is and to quickly fix it.
The only way to get better at PHP coding is to keep practising the basics and to form good habits.
Enjoy the lesson.
Learn how to name a variable correctly in PHP.
What are PHP variables
How do you name a variable in PHP
This lesson covers another fundamental step on your progress towards learning how to code in PHP.
One of the things you will need to do within most of your code blocks is to create and use variables.
In this lesson we look at what is a valid PHP variable and what is not a valid PHP variable.
All variables start with a dollar symbol $ and then either a letter or underscore and can then include any alphanumeric character or underscore. Variables in PHP can not start with a number.
E.g. $name, $_myVariable
There are many coders out there who have their own methods and naming conventions for variables. That is fine if they are not sharing code and only use their code for their own use or within a limited team.
I would urge you to use variable names that make sense and to always comment your code with explanations if you are going to be working on external projects.
Start with good habits from day one and you will find your coding journey so much easier.
Please read the attached document for further information about variables.
Enjoy the lesson!
You will learn how to assign values to variables in PHP
I think it is fair to say that most PHP code written will include the use of variables somewhere.
Think of a variable as a box in which we can store a piece of information. We can then move that information around and pull it out of the box at any time and use it.
REMEMBER from the previous lessons that:
It is a good idea to learn the different variable types such as integer, string, decimal, date etc.
We will briefly look at the PHP online resource manual and see what data types are available for us to use.
Get into good habits early and comment your code!
I show you how to add comments to your PHP code and how to comment out sections of code.
It is always a good idea to comment your code, especially if you have a longer project. When you come back to your code after several weeks, months, or even years, it makes it much easier to remember what you did and what variables actually mean.
In this lesson we learn how to use PHP echo and print functions to view code output.
There does not seem much point in learning to code if no-one is going to see any of your output. So, in this lesson, we look at the difference between echo and print.
There are arguments that echo is faster than print and vice-versa. There are also some other subtle differences in terms of output of singular versus multiple arguments. However, we will not worry about speed differences between the two. The differences are so imperceptible that is really is not worth worrying about!
I rarely use print myself and rarely come across it when coding.
Enjoy the lesson!
In this lesson you will learn how to use concatenation.
You will learn how to use the addition + operator in PHP.
We will also look at shortcut methods for adding numbers.
We now delve into performing calculations with PHP and start with very simple addition and subtraction operators. Hopefully you do not have a fear of math! However, everything is kept quite simple at these early stages of learning to code in PHP.
We will use our understanding of variables and how to assign values. We will then see how we can add and subtract variable values in PHP.
The process is relatively straightforward and if you recall your algebra class from school then you will see the similarities.
Remember that all code from the lesson can be downloaded from the resources section (see the top left of the browser window for the resources link).
In the next lesson we will be looking at multiplication and division using PHP. You may wish to think about how those operations are performed in PHP prior to watching the next lesson after this. See if you can figure it out.
Enjoy the lesson and, as my old math teacher would write on the top of his worksheets, "no calculators allowed".
You will learn how to multiply and divide numbers in PHP.
The multiplication symbol in PHP code is the asterisk *.
The division symbol in PHP code is the forward slash /.
You will learn how to use the PHP modulus operator.
This can be a very powerful PHP operator to use.
It is used to find what the remainder is when one number is divided by another number.
E.g. If we take the number 20 and divide it by 3 then there will be a remainder of 2.
The actual PHP operator for modulus is the percentage symbol %.
You will learn how to raise a number to a given power
In this challenge you will create a basic calculator
Solution for the back to school challenge
Downloadable file containing the code for the back to school challenge
In this lesson you will learn more concatenation strategies.
Another challenge.
The solution to the What's In a Name challenge
The full code of the solution to the WHAT'S IN A NAME challenge
Logical and comparison operators
You will learn how to use the IF statement
You will learn how to use the IF ELSE statement. This lesson builds upon the previous lesson and provides you with more examples.
You will learn how to use the ELSEIF statement
More logical and comparison operators
In this lecture you will learn how to increase and decrease a variable value
In this PHP for Beginners lesson you will learn how to use a FOR loop.
Loops are very important and extremely useful when cycling through variable values, particularly when it comes to using database records (although we don't cover that in this course).
There are different methods we can employ to loop through values and the FOR loop in PHP is just one such way.
You will learn how to use a WHILE loop
The Multiples challenge
Time for another challenge. In this task you have to create a loop which will create a 6 times table
Video solution for the multiplication tables task
Code for the multiplication tables task
The Fizz Buzz Challenge
In this challenge you need to replicate the game of FIZZ BUZZ.
This is known as a common interview question for coders and one which I use a lot in the classroom.
The challenger makes you think about the logical order of test conditions.
Video solution for the Fizz Buzz challenge
Code for the fizz buzz challenge
You will learn how to use the PHP reference manual
You will learn how to generate a random number in PHP
This challenge will test your understanding of simple functions and conditional statements.
Challenge - Odds and Evens
Challenge Solution: Odds and Evens
Full code to the Odds and Evens challenge
In this task you need to calculate the area of a circle using the PI() function and then the ROUND() function to round your answer.
Challenge: Who ate all the pi?
Video solution to the WHO ATE ALL THE PI task
Downloadable code for the WHO ATE ALL THE PI task
How to use the date() function in PHP
In this task you will have to format various dates by using the DATE() function
Challenge: Carpe Diem
Video solution to the CARPE DIEM task
Downloadable code for the CARPE DIEM task
We look a little bit more at some of the available date functions before taking on the next challenge.
This tasks involves counting the number of days until Christmas.
Challenge: Santa Claus is Coming to Town
Video solution to the SANTA CLAUS IS COMING TO TOWN challenge
Downloadable code to the SANTA CLAUS IS COMING TO TOWN challenge.
You will learn how to create a basic HTML page structure including:
You will learn the structure of a basic form and create one from scratch. No styling will be applied. We will just focus on the form structure.
You will learn how to send your form data to a PHP processing script. You will then learn how to check that data has been sent and how to assign it to variables.
This task involves creating a user input form and taking the temperature input and converting it from degrees C to degrees F
Challenge: Temperature Conversion
Video solution to the temperature conversion task
Downloadable file containing the code to the temperature conversion task
You will learn how to use strlen() in order to find the length of a string.
NOTE: If you are using a different character set then you may find that the result for strlen is not what you expected. strlen works for a standard English alphabet. If you have different characters e.g. ä
then you will need to use mb_strlen
In this task you will accept a user input and check the length of the string and then tell them how long the string is.
Video solution to the HOW LONG IS A PIECE OF STRING challenge
Downloadable code for the HOW LONG IS A PIECE OF STRING challenge.
NOTE: If you are using a different character set then you may find that the result for strlen is not what you expected. strlen works for a standard English alphabet. If you have different characters e.g. ä
then you will need to use mb_strlen
In this lesson I show you how to count the number of words in a sentence.
NOTE: If you are using a different character set then you may find that the result for strlen is not what you expected. strlen works for a standard English alphabet. If you have different characters e.g. ä
then you will need to use mb_strlen
In this lesson I show you how to replace characters in a string. This function has many uses, one of which could be as a bad word filter.
In this lesson we look at the str_shuffle() function
Yesterday you received a strange message from HQ which simply said: str_rot13()
Today you received a long coded message:
Rafher gung lbh orpbzr snzvyvne jvgu cuc shapgvbaf nf gurl ner rkgerzryl hfrshy.
Your task is to decode the message and act on it.
Challenge: Mission Impossible
Solution to the MISSION IMPOSSIBLE challenge
<?php
//original messsage
$message = "Ensure that you become familiar with php functions as they are extremely useful.";
//coded message
$encoded = str_rot13($message);
echo $encoded;
echo "<br>";
//decoding the message
$return = str_rot13($encoded);
echo $return;
In this lesson we look at the difference between double and single quotes.
In this lesson we look at how we can escape strings. I show you the use of double and single quotes.
In this challenge you will escape strings in order to have valid output. Not as easy as it first sounds!
Challenge: The Great Escape
The video solution to THE GREAT ESCAPE challenge
Downloadable code for THE GREAT ESCAPE challenge
You will learn what an array is in PHP
You will learn how to output data from an array. This is extremely useful for when we start to connect with databases.
You will learn how to split an array at a given point and in a given length using array_slice()
In this task you will:
Challenge: ISBN Checker
Video tutorial solution to the ISBN checker challenge
Downloadable file of the solution to the ISBN checked challenge
In this challenge you will use your knowledge of arrays and strings to filter out inappropriate words from user inputs
Challenge: Mind Your Language
Video solution for the MIND YOUR LANGUAGE challenge
In this lesson you will learn how to sort data in an array and then output the results.
I will show you the following functions:
You will learn how to use the explode() and implode() functions on strings.
You will learn how to add items to an array using array_push() and array_unshift()
In this challenge you will take a list of 10 cities and place them into an array. You will then sort them alphabetically and output the result as an ordered list. For example, the output may look like this:
Challenge: Around the World in 80 Days
Video solution for the AROUND THE WORLD IN 80 DAYS challenge.
Downloadable code for the AROUND THE WORLD IN 80 DAYS challenge
You will learn how to remove single elements from an array using array_pop() and array_shift()
In this lesson we learn how to use the array_slice() function to split an array.
In this task you will need to take a series of temperatures and place them into an array, then order them, then find the 5 hottest temperatures and output them.
Challenge: It's getting hot in here
Video solution for the IT'S GETTING HOT IN HERE challenge
Code for the challenge: It's getting hot in here
You will learn how to shuffle an array and select a random element from an array
In this task you will generate a random card from a pack of 52 playing cards. You will need to use the array_rand() function to return a random element from an array.
Challenge: Pick a card, any card
Video solution for the PICK A CARD, ANY CARD challenge
Downloadable code for the PICK A CARD, ANY CARD challenge
In this task you need to consider user inputs and how we can validate these. In this activity you will be validating a credit card number.
Although most online stores process payments via external payment processors, it is still a nice little activity to get you thinking about the logic behind the code...something that most beginners find quite challenging.
NOTE: you will need to spend some time thinking about the logic behind the code.
Challenge: Let's go shopping
Video solution to the LET'S GO SHOPPING CHALLENGE
NOTE: the logic within this solution does take some thought. It is recommended that you plan your solution carefully and use pseudo-code.
Downloadable code for the LET'S GO SHOPPING challenge
You will learn how to understand associative arrays and how to structure them. We look at the terms KEY and VALUE.
You will learn how to output the associative array.
You will learn how to use a FOREACH loop to output the KEY VALUE pairs in an associative array.
In this task you will need to take an associative array and output the elements in order using asort() and ksort()
Challenge: Capital cities of the world
Video solution of the CAPITAL CITIES OF THE WORLD challenge
Code for the Capital Cities of the World challenge
REGULARLY UPDATED PHP FOR BEGINNERS COURSE
FREE access to the first 4 sections of the course. I strongly encourage you to watch the first 4 sections before you join.
Every line of code used is explained
Full support with all questions answered promptly
7 hours of video content
Students consistently say how much they LOVE this course due to its unique delivery method and challenges which enable you to use your new skills immediately. Join over 8000 other students who have successfully learnt to code in PHP by enrolling in this course.
STUDENT SUCCESS STORY: From a grade D to A-
"Hello and thank you, Professor Patrick! I want to Thank you for all your support and help. I received an 'A-' for the course I was taking [at university]. Some people would say that was not good. But they have no idea how much I was struggling. And with your course and help my grade came up from a 'D' to the given grade [A-]. I'm still going using your course to keep my mind skilled in the information. Which I think is best so I will not forget how to perform and execute the information properly. Professor Patrick I truly cannot thank you enough!" Adrienne Stiger
This PHP for beginners course introduces you to PHP through carefully crafted examples and fully worked tasks. Learning by doing is what this course is all about. You will experience real world examples of PHP code use.
Have you seen other courses that use complex terms or that jump steps and leave you thinking "why did that just happen"? You won't find that with this course because every line of code is explained and is very easy to follow.
This course has been designed with the coding beginner in mind or those who may have picked up bad habits and wish to refresh their coding skills.
On hand to help and guide you is a renowned national award-winning teacher who has taught 1000s of students over a career of over 25 years.
Highlights of this course include:
Full code from every example and mini task shared with you online
Carefully crafted challenges and full solutions with FULL explanations of every line
Demonstration of a shared coding environment
Dozens of real world examples with more added on a regular basis
A tutor who cares about his students
Regular updates and new challenges
Every line of code is explained in full detail to ensure that you can progress from absolute beginner to competent coder very quickly.
I am so confident that you will enjoy the course that I have provided FREE access to the first 4 sections. If you like my style then and want to continue to learn then JOIN NOW and follow the remainder of the course.
STUDENT REVIEW: " Amazing"
STUDENT REVIEW: "I’ve enrolled in many courses here on Udemy and to be honest I’ve abandoned most of them because they are like entertainment to me. I classify them as entertainment because knowledge without action is entertainment. This course is outstandingly different, since as you learn you’re challenged to act on that knowledge. I’m now a better programmer as a result of taking this course, previously I used to struggle with transferring my real world logic to computer code. I’m in no way saying that I’m an expert now but my thought process has been adjusted due to Mr. Morrow’s effective teaching method."
STUDENT REVIEW: "This was my first intro to php (in preparation for the php section of my coding bootcamp class I'm currently enrolled in), and the instructor explained everything really well. The pace was just right (for me). I already purchased his php part 2 course, so I can't wait to get into that! Excellent course, content, and instructor!"
STUDENT REVIEW: "Enjoyed this course and learned quite a bit, having the challenges to do, made me use my brain. Excellent instruction. Thank you Patrick. Now time to move onto your next course on PHP and MySQL."
STUDENT REVIEW: "Excellent beginner course, with practical and realistic tasks. Very efficient"
STUDENT REVIEW: "Now that I completed the course, I must say this is one of the best online courses that I participated in.The material is represented systematically, step by step and really every line of code is explained. The good practices are encouraged and as a content the really qualitative ground basic knowledge is taught. What really impressed me is that every example seems thoughtfully prepared in advance, no meaningless examples can be found, like in some other courses. The author encourages self development and the tasks are carefully prepared, to confirm the knowledge taught and to develop thinking and skills. I am really impressed!"
The above are just a few of many 1000s of positive reviews. I encourage you to follow the first 4 sections of this course FREE of charge to see if it matches your needs and preferred learning style. If it does then join the full course and follow the remainder of the course with full support.
THE DEVELOPMENT ENVIRONMENT
IMPORTANT: Please read carefully
You are free to use ANY development environment including the one that you are already using (if any). In this course, I show you how to download and install Visual Studio Code and MAMP (both of which are FREE and available for Mac and Windows).
If you are unsure about which code editor option is best for you then I encourage you to contact me and I will be happy to discuss the options with you.
You can also follow this course using your own preferred code editor.
Once again, using Visual Studio Code with MAMP is OPTIONAL. You can use ANY suitable development environment of your choosing.
MY PROMISES TO YOU
As a registered teacher (yes, I teach in a real classroom every day), I strongly believe it is my job to ensure you feel totally supported when taking my classes. I therefore promise the following:
to respect you as a student and individual with your own learning needs
to be courteous and polite in our interactions
to answer your questions about the course content promptly
to fix any issues you may encounter with the lessons
to respond promptly to feedback
I really do look forward to welcoming you to this course. I am confident you will enjoy the approach of learning what each line of code actually means.
Join the course today.