How-to articles, tricks, and solutions about PHP

How to increment letters like numbers in PHP?

In PHP, you can use the ++ operator or the += operator to increment letters, just like you would with numbers.

How do I capture PHP output into a variable?

In PHP, you can use the output control functions to capture the output of a PHP script into a variable.

Changing a global variable from inside a function PHP

In PHP, global variables can be accessed and modified from within functions using the global keyword.

How to check where Apache is looking for a php.ini file?

You can check where Apache is looking for the php.ini file by running the command php --ini in the command line.

unexpected 'use' (T_USE) when trying to use composer

This error message is indicating that there is an unexpected use of the keyword "use" in your code when trying to run Composer.

postgresql insert null value on query

To insert a NULL value into a PostgreSQL database table column using PHP, you can use the NULL keyword in your INSERT query.

How to add a print button to a web page

To add a print button to a web page using PHP, you can use the following steps:

How to check if not instance of some class in symfony2

In Symfony2, you can check if an object is not an instance of a certain class using the "instanceof" keyword in combination with the "!" (not) operator.

Execute a string of PHP code on the command line

To execute a string of PHP code on the command line, you can use the "php" command followed by the "-r" option and the string of code in quotes.

Send email with a template using php

To send an email using PHP, you can use the "mail()" function.

Laravel - where less/greater than date syntax

In Laravel, you can use the where method on a query builder or an Eloquent model to filter records based on a date column using less than or greater than operators.

Laravel 5.3 multiple file uploads

In Laravel 5.3, you can use the Request object's file method to handle multiple file uploads.

Deprecated: Function split() is deprecated. How to fix this statement?

The split() function is deprecated, which means it is no longer supported and should not be used in new code.

PHP Mail, CC Field

In PHP, the "CC" field can be included in an email using the "mail" function by adding a "CC" header to the additional headers parameter.

How To Use setInterval in PHP?

setInterval is a JavaScript function and cannot be used directly in PHP.

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.

Laravel 5 change public_path()

In Laravel 5, you can change the value of the public_path() function by modifying the 'public' key in the config/filesystems.php configuration file.

laravel - get parameters from http request

In Laravel, you can use the $request object to access parameters from an HTTP request.

WSDL to PHP with Basic Auth

There are a few ways to convert a WSDL file to PHP code with Basic Auth.

How to benchmark efficiency of PHP script

There are several ways to benchmark the efficiency of a PHP script, including:

How to properly set up a PDO connection

To set up a PDO connection, you will need to do the following:

Run process with realtime output in PHP

In PHP, you can use the proc_open function to run a process and read its output in real-time.

How to get Magento customer ID

In Magento, you can get the customer ID of a logged-in customer using the following code:

PHP: move_uploaded_file(): Unable to move '/

The error message typically occurs when the PHP script is trying to move an uploaded file from its temporary location to a new destination.