How-to articles, tricks, and solutions about PHP
Using $this inside a static function fails
Using $this inside a static function is not allowed in PHP because the $this variable is only available within the context of a non-static method.
How to fake $_SERVER['REMOTE_ADDR'] variable?
It is generally not recommended to fake the $_SERVER['REMOTE_ADDR'] variable, as it can lead to security vulnerabilities and potential abuse of the system.
Multiple excerpt lengths in wordpress
In WordPress, the length of the excerpt (the summary text displayed on the homepage or archive pages) can be controlled by the theme or by a plugin.
Title case a string containing one or more last names while handling names with apostrophes
In PHP, you can use the ucwords() function to convert a string to title case.
Send html form data to sql database via php (using mysqli)
To send HTML form data to a SQL database using PHP, you will need to use the mysqli (MySQL Improved) extension in PHP.
How can I print all the values of an array?
In PHP, you can use a foreach loop to iterate through an array and print each value.
PHP sort array alphabetically using a subarray value
In PHP, you can use the "usort" function to sort an array by a specific value of a subarray.
How check if a String is a Valid XML with-out Displaying a Warning in PHP
In PHP, you can use the simplexml_load_string function to check if a string is a valid XML without displaying a warning.
Adding Query string params to a Guzzle GET request?
To add query string parameters to a GET request using Guzzle, you can use the query option when creating the request.