How-to articles, tricks, and solutions about PHP

What does the PHP error message "Notice: Use of undefined constant" mean?

The PHP error "Notice: Use of undefined constant" means that you are trying to use a constant that has not been defined yet.

What does this mean? "Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM"

This error message is indicating that there is a problem with the syntax of the code, specifically a parse error, and that it was unexpected to find the token "T_PAAMAYIM_NEKUDOTAYIM" in that particular place in the code.

What is mod_php?

mod_php is an Apache module that allows PHP code to be executed directly by the Apache web server.

What is PHPSESSID?

PHPSESSID is a session cookie that is used to identify a user's session on a website.

What is stdClass in PHP?

In PHP, stdClass is a predefined class, which is part of the PHP standard library

What is the difference between public, private, and protected?

In PHP, public, private, and protected are access modifiers that control the visibility of class properties and methods.

What is the difference between single-quoted and double-quoted strings in PHP?

In PHP, single-quoted strings and double-quoted strings are very similar, with a few key differences.

What is the difference between the | and || or operators?

In PHP, the "|" and "||" operators are both bitwise and logical operators.

What is the PHP Equivalent of .NET/Java's toString()?

Here is a short tutorial representing to you the most accurate PHP equivalent of .Net/Java’s to string. Read it carefully and check out the examples.

What is thread safe or non-thread safe in PHP?

In PHP, a thread-safe version of PHP is built with additional constructs to ensure that certain actions are atomic, which means that they are performed in their entirety without any other thread being able to interfere.

What's the difference between ++$i and $i++ in PHP?

In PHP, "++$i" is the pre-increment operator and "$i++" is the post-increment operator.

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

net::ERR_HTTP2_PROTOCOL_ERROR is an error that occurs in the Google Chrome browser when there is an issue with the HTTP/2 protocol.

When should I use Memcache instead of Memcached?

Memcache and Memcached are both in-memory key-value stores that are commonly used to cache data to improve application performance.

When to Use self and $this in PHP

This snippet is dedicated to the the main ways of using self and $this keywords in PHP. Here, you will learn how to use them and their main differences.

Where are $_SESSION variables stored?

In PHP, $_SESSION variables are typically stored on the server in a file or a database.

Where can php.ini be Found

This tutorial is dedicated to an issue that any developer may come across. It’s where to find the php.ini file. Choose among the three methods provided.

Where do we use the object operator "->" in PHP?

The object operator "->" is used in PHP to access a property or method of an object.

Where Does PHP Store Error Log

In this short tutorial, we are going to represent to you how to find where the PHP error log is located.

Where does PHP's error log reside in XAMPP?

In XAMPP, the error log for PHP is typically located at {xampp-install-directory}/php/logs/php_error_log.

Where is localhost folder located in Mac or Mac OS X?

On Mac and Mac OS X, the localhost folder is located at:

where is php.ini on ubuntu?

On Ubuntu, the location of the php.ini file depends on the version of PHP you have installed.

Where is the php.ini file on a Linux/CentOS PC?

On a CentOS system, the php.ini file is usually located in the /etc directory.

Where to find composer's global packages?

Composer stores global packages in the "vendor/bin" directory within your system's home directory.

Which is a better way to check if an array has more than one element?

There are several ways to check if an array has more than one element in PHP.

Why can't PHP create a directory with 777 permissions?

PHP's mkdir() function, which is used to create a new directory, defaults to using the server's current umask setting when determining the permissions of the newly created directory.