Creating files in PHP

We will see how to create files in PHP in different ways. Below is a list of the content in this entry. Content: Intro In PHP, there are two ways to create files. The first is by opening and closing the file manually, like in many other programming languages, and the second is by using […]

read more
Uploading files in PHP

In this section, we’ll cover the topic of uploading a file to your server via PHP, and what considerations you should keep in mind to achieve it. Contents: Intro If there’s something we’ll inevitably cover, it’s file uploads to our server or another source where we can use them. In this section, we’ll see how […]

read more
PHP making directories with mkdir function

To create a directory in PHP, you use the mkdir() function, which can accept up to four parameters. The basic syntax is as follows: Syntax mkdir ( string $pathname [, int $mode = 0777 [, bool $recursive = FALSE [, resource $context ]]] ) : bool The content you provided explains the mkdir() function in […]

read more
Sending email with PHPMailer

In this section, we will see how to send emails using PHPMailer, a class described by its creators as a ‘full-featured email creation and transfer class for PHP.’ In the previous topic, we discussed PHP’s mail() function but did not address some of its limitations. These include encryption, authentication, HTML messages, and attachments. As we […]

read more
Variables variables, variable functions and variable object ($$)

We will explore the use of $$ for various purposes in PHP programming. Contents: Introduction Making the name of a function or an object variable gives us certain flexibility in using functions and objects in ways that may not have been considered before. If you’ve already read the previous PHP-101 topics or understand what a […]

read more
PHP – Interfaces and predefined Classes

In this section, we will simply define what these are without further explanation, as they are predefined classes and interfaces commonly used without us noticing. For example, Throwable is used with exceptions or Closure when creating an anonymous function. If you are interested in any of these classes or interfaces, you can dive deeper into […]

read more
PHP – Predefined Exceptions

PHP provides a robust mechanism for handling errors and exceptions through its built-in exception classes. These exceptions are organized in a hierarchical structure, making it easier to catch and handle specific types of errors. Predefined Exceptions Class Tree Exception: Exception is the base class for all exceptions in PHP 5 and for all user exceptions […]

read more
PHP – What are generators?

In PHP, a generator allows you to write code that uses foreach to iterate over a dataset without needing to load the entire array into memory. Loading an array into memory can exceed memory limits or require a significant amount of processing time to generate. Generators, or generator functions, help address this issue because they […]

read more
Handling URL Parameters with $_GET in PHP

In this article, we will look at how $_GET works in PHP. $_GET is an associative array of variables passed to the current script via URL parameters. Let’s see a really simple example. Below, we’ll create a form that passes a name via URL to the same path using $_SERVER[‘PHP_SELF’]. In my case, I have […]

read more
PHP Predefined Variables

For now, we’ll quickly go over PHP predefined variables, but we will delve deeper into them in future posts that will also be part of PHP 101. Superglobals — These are internal variables that are always available, meaning it doesn’t matter whether you’re in a local or global scope. Superglobal variables: $GLOBALS — Refers to […]

read more

Comments