PHP Archives - Page 5 of 6 - Ian Carnaghan

How to remove all characters exept numbers from a string using PHP

This is really easy, we will make use of the preg_replace PHP Function which is 100% compatible with PHP 5.3 Example:  $string = 'This...

Mar 22 · 13 sec read >

How to remove all empty/null values in an array using PHP

If you have an array with empty values and you wish to remove the empty valuesyou can use the following one line code $array =...

Mar 22 · 13 sec read >

PHP Script that deletes files within a remote directory via FTP older than a given amount of days

The following PHP script lets you connect to a remote location via PHP’s FTP functionality and delete all files...

Mar 22 · 1 min read >

How to remove a specific value within an array using PHP

If you have an array and you wish to remove the “None” values in the array you can use the method...

Mar 22 · 15 sec read >

How to transform a month number to month name using PHP

$month = 1;   $month_name = date("F", mktime(0,0,0,$month,1,2011));   echo $month_name; //Will output January

Mar 22 · 2 sec read >

Calculating the date difference in days using PHP

If you have 2 dates and you need to calculate the total days between these two dates using PHP...

Mar 22 · 24 sec read >

How to check if the CURL extention is installed and compiled with PHP

Add this line of code to a PHP script var_dump(curl_version()); If there was a error similar to this Fatal error:...

Mar 22 · 8 sec read >

How to increase the file upload size for PHP using the .htaccess file

Copy the following lines into your .htaccess file, you may adjust the values as you see fit  php_value upload_max_filesize 10M  ...

Mar 22 · 7 sec read >

When generating PDF via PHP using wkhtmltopdf PDf contains garbled squares and characters

I recently installed WKHTMLTOPDF on a Centos 6 Box to generate PDF’s via PHP, after a huge struggle to get WKHTMLTOPDF working, I encountered another problem, whenever trying...

Mar 22 · 29 sec read >