function rename_if_exists($dir, $filename) { $ext = strrchr($filename, ‘.’); $prefix = substr($filename, 0, -strlen($ext)); $i = 0; while(file_exists($dir . $filename)) { // If file exists, add a number to it. $filename = $prefix . ++$i . $ext; } return $filename; }
Category Archives: PHP
PHP readfile
Returns the number of bytes read from the file. If an error occurs, FALSE is returned and unless the function was called as @readfile(), an error message is printed.
Generating PHP Documentation With NetBeans IDE
This screencast shows how to generate PHP documentation using PHPDocumentor with NetBeans IDE. Built-in support for PHPDocumentor was added in NetBeans IDE 7.0. The screencast includes details of installing PHPDocumentor with PEAR and configuring PHPDocumentor, NetBeans IDE and your php.ini file. This video is especially useful for developers using NetBeans on a Microsoft Windows operating …
Continue reading “Generating PHP Documentation With NetBeans IDE”
Sending e-mails via SMTP with PHPmailer and Gmail
SMTP for Gmail tutorial If you don’t have one, register a GMail account or setup your domain for Google applications. Download a recent version of PHPMailer (I used the version 5.02) Check with your web hosting provider if port 465 (TCP out) is open, if not ask him to open that port Include the PHPMailer class …
Continue reading “Sending e-mails via SMTP with PHPmailer and Gmail”
PHP Tutorials: Introduction to Facebook application development
Part 1
get started with PHP themes
1) "CSS ZEN" This is where the markup remains unchanged, but you totally change the design just by using CSS and images. Demonstrated very well on http://www.csszengarden.com/