Over the years I have been involved in fixing numerous websites that are performing slow. The PHP execution time on some were insane, into the many minutes. Nearly every time it has been down to the getimagesize() function. This function is terribly slow and should only be used if absolutely necessary. One thing people seemRead more about Don’t use getimagesize() – PHP[…]
I was having an issue with phonegap where an application on a specific phone would randomly crash after selecting a photo for uploading. I installed ACRA ( http://acra.ch/ ) so the phone can send a dump when it crashes. This turned out to be quite useful. The dump contained this part of interest The phoneRead more about Phonegap/Cordova out of memory when taking photos[…]
A client has software which does not honour commas within quotes. So all commas within quotes need to be removed before the CSV export is sent to the client. This function would be called for each line in the csv. $csv_data is the CSV to be parsed $replace_char is what to replace the comma with.Read more about Remove commas from within quotes in a CSV[…]
This was something I quickly threw together to randomise a folder of photos. Basically you put all your photos in one folder, it then randomly copies them to an output folder with a new file name. This was used for randomising photos for a photo DVD at a party. Its fine for basic things. IfRead more about Code Snippet: Photo Randomiser[…]
A friend wanted some simple code to count the number of times each email address in a list used the same domain.
Code Snippet: Want to see all your PHP settings? Place the following code in an empty .php file on your server Be sure to not leave this on your server once you are done with it as it could show potential security holes.
if( strpos($url, ‘http://’) === false ) $url = ‘http://’ . $url; Or if you are a fan of single line functions $url = ( strpos($url, ‘http://’) === false ) ? ‘http://’ . $url : $url;