PHP Tutorials

1. PHP convert string to lower case

By: Manoj : 2023-03-22

Description: In PHP, you can convert a string to lowercase using the strtolower() function. Here is an example:

2. Convert XML to CSV in PHP

By: David Thomas : 2014-10-06

Description: Output XML string as CSV with first row as column headers

3. PHP code to write to a CSV file for Microsoft Applications

By: Soapergem @ gmail . com : 2014-10-06

Description: I've created a function for quickly generating CSV files that work with Microsoft applications. In the field I learned a few things about generating CSVs that are not always obvious. First, since PHP is generally *nix-based, it makes sense that the line endings are always \n instead of \r\n. However, certain Microsoft programs (I'm looking at you, Access 97), will fail to recognize the CSV properly unless each line ends with \r\n. So this function changes the line endings accordingly. Secondly, if the first column heading / value of the CSV file begins with uppercase ID, certain Microsoft programs (ahem, Excel 2007) will interpret the file as being in the SYLK format rather than CSV, as described here:

4. PHP code to write to a CSV file from MySQL query

By: Jamie : 2014-10-06

Description: Utility function to output a mysql query to csv with the option to write to file or send back to the browser as a csv attachment.

5. PHP code to import from CSV file to MySQL

By: Nate : 2014-10-06

Description: After playing a while, I'm confident the following replacement function works in all cases, including the ones for which the native fputcsv function fails. If fputcsv fails to work for you (particularly with mysql csv imports), try this function as a drop-in replacement instead.

6. Password must include both numeric and alphabetic characters - Magento

By: Emiley J : 2014-02-08

Description: While installing a fresh Magento installation, some users are stuck at the 'Create Admin Account' step, with this error: 'Password must include both numeric and alphabetic characters.'. Follow this simple step to resolve this issue.

7. Error: Length parameter must be greater than 0

By: capitanqueso : 2012-12-05

Description: If you ever try to upload an empty file using fread(), php may show a nasty warning (according to your "error_reporting") about "Length parameter must be greater than 0" especially if you are parsing this as xml. So in order to handle this error from here you may do the next:

8. PHP file upload (Large Files)

By: xmontero : 2012-12-05

Description: It may happen that your outgoing connection to the server is slow, and it may timeout not the "execution time" but the "input time", which for example in our system defaulted to 60s. In our case a large upload could take 1 or 2 hours.

9. PHP file upload prompts authentication for anonymous users

By: Phil Ciebiera : 2012-12-05

Description: On a Microsoft platform utilizing IIS, you may run into a situation where, upon moving the uploaded file, anonymous web users can't access the content without being prompted to authenticate first...

10. PHP file upload with IIS on windows XP/2000 etc

By: [email protected] : 2012-12-05

Description: For those of you trying to make the upload work with IIS on windows XP/2000/XP Media and alike here is a quick todo.