How-to articles, tricks, and solutions about PHP

Why is textarea filled with mysterious white spaces?

There could be a number of reasons why a textarea element in a PHP webpage might be filled with mysterious white spaces.

Why shouldn't I use mysql_* functions in PHP?

The mysql_* functions in PHP are deprecated, meaning that they are no longer recommended for use and will likely be removed in a future version of PHP.

Woocommerce get products

You can retrieve a list of products in WooCommerce using the get_products() function.

WordPress - Check if user is logged in

In WordPress, you can use the function is_user_logged_in() to check if a user is currently logged in.

WordPress Issue: Cannot modify header information - headers already sent by

This error message appears when a PHP script is trying to modify the headers of an HTTP response after the headers have already been sent.

WSDL to PHP with Basic Auth

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

XAMPP Port 80 in use by "Unable to open process" with PID 4

It looks like you are having an issue with XAMPP and port 80.

XAMPP: Couldn't start Apache (Windows 10)

There are a few things you can try if you are having trouble starting Apache in XAMPP on Windows 10:

XML Parse Error - Extra content at the end of the document

This error message typically occurs when there is additional content or characters after the closing root element in an XML document.

XSS filtering function in PHP

Here is an example of a basic XSS filtering function in PHP:

ZIP all files in directory and download generated .zip

Here is an example of how you can use PHP to create a ZIP archive of all files in a directory and then prompt the user to download the generated ZIP file: