Blog
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.
PHP Lessons - Lesson 1 - Working with Forms
In everyday life, we get information from television, radio, the internet, or through live communication. Websites also receive information from users, but they do so in a special way — through forms. Forms can be compared to paper questionnaires or official application forms. Despite the limited number of form elements, forms allow websites to gather all the necessary user data.
To get the most out of this lesson, you should review basic HTML form creation tutorials.
PHP Lessons - Lesson 2 - Working with files: opening, writing, reading.
In the previous lesson, we built the framework for our guestbook, blog, or chat application. Now it’s time to add functionality. In this lesson, we’ll save entries to files and display entries from those files.
PHP has many functions for file operations. We’ll look at a few of them. Most likely, your website will store data in a database (I’m sure of that) rather than in files. So we’ll just touch on the basics here to give you an understanding. We'll cover working with databases later.
If you don’t have the files from the last lesson, go back and download them first.
PHP Lessons - Lesson 3 - Working with MySQL DB.
You might think it’s too early to begin the third lesson with working in MySQL. But trust me, it’s not. Learning PHP as a web programming language without learning how it interacts with databases is like having a computer without internet. Yes, you can work on such a computer, but you won’t be able to get information. So let’s grit our teeth and start writing SQL queries, even if we know nothing about the SQL language yet.
PHP Lessons - Lesson 3.1 - Working with MySQL DB. Creating tables.
In the previous lesson, we created a connection to the database. In this lesson, we’ll create tables for our future website. First, let’s add the name of the required database in the simpleCMS
class: