PHP Lessons - Lesson 6 - PHP Operators
We’ve already explored string and numeric variables, and learned that numeric variables in PHP can be of various types: integers, floats, booleans. Now it’s time to learn how to operate on them, modify them, and perform arithmetic.
Below are tables illustrating the use of different PHP operators.
PHP Lessons - Lesson 7 - PHP Functions and Functional Programming
I think we've reached the point where it's time... it's time to finally start programming. After this lesson, you can say you've written code in PHP. Quite often, you'll need to reuse pieces of code on different pages or in different PHP files. To avoid duplicating code, PHP provides functions.
PHP Lessons - Lesson 8 - The if statement
Quite often, depending on circumstances, we have to make decisions. In programming—just like in life—actions depend on conditions. In life we use our head to make decisions, in PHP we use the if statement. For example: if it rains, I’ll take an umbrella; if it’s warm, we’ll go to the beach. In PHP, we evaluate expressions for truth and perform actions accordingly:
PHP Lessons - Lesson 8-2 - The switch statement
In the previous lesson, we learned about the if
statement. The if
statement allows us to check a condition and execute specific actions based on the result.
Now imagine you need to perform ten different checks and execute different actions based on each result. Sure, you could write this using multiple if
statements:
PHP Lessons - Lesson 9 - Recursion
In the previous lesson, we explored the use of functions in PHP. Now, we’ll dive deeper into how functions can be used. Previously, we used functions like this:
<?php function myFunction() { // function declaration } $x = myFunction(); // function call ?>
But what happens if we call a function from within itself?
PHP Lessons - Lesson 10 - Arrays
Up to this lesson, we’ve only been working with numeric and string variables. Now, let’s explore arrays in PHP. Arrays can contain both numeric and string variables, which is why they are called arrays.
PHP Lessons - Lesson 11 - Functions for Working with Strings and Arrays
We already know different data types and some functions for working with them. In fact, PHP has a huge number of built-in functions — so many that a full review would take more than one textbook. So let's focus on a few essential ones. We'll start with how to convert an array into a string, and then back from a string into an array.
PHP Lessons - Lesson 13 - OOP (Object Oriented Programming) Basics
In previous lessons, I’ve already discussed the following PHP data types: boolean, integer, float, string, and arrays. In this lesson, I’ll introduce one more data type available in PHP — the object.
Objects are somewhat similar to arrays — they can contain various data types including numbers, text, arrays, and even other objects.
PHP Lessons - Part 2 - Forms, Files, Sessions and Security in PHP
If you’ve read the first part of the PHP lessons, then you already know at least how to write code in PHP. In this part, we’ll dive deeper into the language and explore the following topics:
- Working with forms in PHP
- Working with files in PHP
- Cookies in PHP
- Sessions in PHP
- Sending emails with PHP
- Security in PHP
However, we won’t study these topics separately as traditional PHP tutorials often do. Instead, we’ll apply all these features in the process of creating a small website.