Tutorials » PHP

Solve mysqli_select_db method expects different type than given string
As many people noticed in the tutorial on how to solve deprecated MySQL extension issues, I want to explain now how to solve the typical PHP error Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given now. How to solve the warning? Currently your code most likely looks like that: The correct way to call this PHP method to…
View whole tutorial »
Solve PHP uncaught ArgumentCountError: Too few arguments to function
With the upcoming PHP 7.1, former warnings when passing too few arguments to a function got raised to an ArgumentCountError exception with the following format: This change only applies to own defined functions, not PHP internal functions. That ArgumentCountError exception gets thrown when your software passes not the minimum required arguments to a user defined function. To fix that error…
View whole tutorial »
Create PHP alternative for mysql_result in MySQLi
If you are migrating from PHP 5.5 to a newer version of PHP - you might be interested in a MySQL to MySQLi/PDO migration guide - and use the function mysql_result() you might get a notice (in case your error_reporting is set to show deprecated warnings) that this function is deprecate. Since there is no 1:1 alternative you can build…
View whole tutorial »
Decode and solve in PHP quoted-printable characters from plain emails
If you handle Mails in PHP they sometimes contain 8bit strings like =3D or =0A or =0D etc. when trying to get the plain text mail out of a HTML mail for example. The PHP engine brings a built-in function called quoted_printable_decode() to decode such strings and get the plain, normal looking mail in return. Decode those bit strings Let's…
View whole tutorial »
Solve PHP function split() is deprecated
To solve the deprecated warning (occurring since PHP 5.3) with the split function you have two possibilities, depending what you try to split with the built-in function. Simple string splitting In the most cases you try to split by a simple string, then you could replace the current split with explode (fastest possibility). Splitting by regular expression In case you…
View whole tutorial »