Section dedicated to content, courses, tutorials and books for learning and training in PHP programming language.

Sections

How to Generate a Random String with PHP

From time to time in software development, we encounter the need to generate random strings for passwords, tokens, or other purposes. In this article, we’ll explore how to generate random strings in PHP, looking at various methods and understanding the security and complexity levels of each approach.

What Is a...

String interpolation is one of those features in PHP that make the language both powerful and easy to use. It allows you to embed variables directly within strings, making string manipulation more intuitive and readable.

You’ll understand better, but just to clarify, in PHP, string interpolation only works with...

What is a PHP Session

As seen in What is HTTP Sessions, a session ia a way to persist user data (or software needs data) across several requests from the same Http client.

In PHP, a SESSION is a global array used to store information about a user’s individual session. It’s a way that enables you to create personalized...

PHP Composer, error: Invalid version string

Recently working with PHP Composer on a project that is based on the Laravel framework, I came across the error: Invalid version string. More precisely when performing the attempt to install a Laravel package that allows me to use models with the logical strategy of Eloquent to access MongoDB databases.

The package...

featured-wordpress.png

Since WordPress is a CMS (Content Management System) with the possibility of using external themes and plugins, it is common for some errors to happen after the installation, even for testing, of a new extension of this nature on your site.

It is also susceptible to some errors when a PHP or Apache or Nginx version...

featured-private.jpeg

Private and protected methods should not be accessed outside the permissible scope of class or subclasses. But there are some situations where this is necessary, for me in some contexts of automated testing (unit or integration), or in others where I am implementing a feature and want to perform punctual executions to...

PHP Dates: Fetching the Previous Day or Month pr Year

Get the Previous Dates in PHP

Dates and timestamps are crucial in many software systems and web applications. They allow us to track events, analyze patterns, and provide users with pertinent information based on time. In this post we’ll explore how to handle dates in PHP, specifically on how to get the date for...

featured-copyright.webp

Adding the copyright information with the current year in the footer of websites and blogs is important to convey to your audience the information that the content they find is “alive” and updated on this site. It is also interesting to add the year of the beginning of the site, the more information about...

featured-php-timeout.webp

When executing PHP scripts called by web browsers, it is important to monitor their execution time to prevent timeouts from occurring.

In this guide, we will explore different methods to increase the PHP max execution time, ensuring your scripts have enough time to complete their tasks without affecting server...

featured-wrong-charset-php.webp

When working with different character encodings in PHP and Laravel, you might encounter errors on charset convertion like the following: iconv(): Wrong charset, conversion from 'UTF7-IMAP' to 'UTF-8//IGNORE' is not allowed

This error occurs when attempting to use the iconv() function to convert a string from the...

php-ini-featured.webp

There are a few ways to locate php.ini file by command line on Linux Ubuntu, Linux Mint, and other Linux distributions. Some of the options showed here are also compatible with Windows, specially usin WSL.

What is php.ini

The php.ini file is the configuration file that is read when PHP starts up. For the server module...

featured-php-session-timeout.webp

A session is a way to store information (in variables) to be used across multiple HTTP Requests, to simulate a “state” across pages navigation.

Unlike a cookie, the information is not stored on the end users computer but in the application server.

For security reasons, sessions has a time limit to exist...

featured-class-numberformatter-not-found.webp

If you have ever come across “NumberFormatter Class Not Found” error when installing a PHP Laravel application on a Windows or Linux server, this article will help you resolve this issue.

Let’s explore in this article the cause for the error class "numberformatter" not found in PHP Laravel,...