$ grep -r "#php" ./posts
Tag

#php

// 8 matches

Cannot send mail in Mac OS X 10.8 Mountain Lion

There is an error while sending mail in Mac OS X Mountain Lion 10.8: send-mail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory To fix just run in terminal: sudo mkdir -p...

Date format validation in PHP

In case of date format checking in PHP just use this function: function checkDateFormat($date) { //match the format of the date if (preg_match ("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $date, $parts))...

Convert a string into an URL safe address

/** * Convert a string into a url safe address. * * @param string $unformatted * @return string */ public function formatURL($unformatted) { $url = strtolower(trim($unformatted)); //replace accent...

Scanning for Viruses Using PHP and ClamAV

Here what I found and like most. PHP Code for directory scanning: // Set the allowed types for reading and upload. $types = array ('jpg', 'jpeg', 'txt'); // Start a variable. $dir_files = array(); //...

PHP Get File Extension

Just some examples: $filename = 'sample.gif'; // 1. The "explode/end" approach $ext = end(explode('.', $filename)); // 2. The "strrchr" approach $ext = substr(strrchr($filename, '.'), 1); // 3. The...

PHP: explode() or split()?

Actually explode() isn’t the same as split(). The biggest difference is that explode() takes in parameters a delimiter to split by, while split() takes a regular expression. This means that...

IT-Digest AI Assistant