I think it should be interesting for all PHP developers.
How fast/slow are the static methods?
I did a test once to try and figure that out.
It turns out:
- Calling a method statically is just a bit faster than calling it “normally”
- Calling a static method is twice as fast if your object didn’t exist to begin with
- Static methods are twice as slow than function calls
A comprehensive and complete checklist to secure your php based web application, each point of the list include a brief description to fully understand the problem.
The author also provide a PDF version for a very quick review.
PHP offers us the perfect solution to force the download of a file and propose to the user a filename:
$file ='monkey.gif';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header'Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '. filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
SmartImage is a free PHP class under LGPL licence.
With SmartImage you can easily:
It is really simple to use, for instance you can resize and image with 4 lines of code:
include "SmartImage.class.php";
$img = new SmartImage($src);
$img->resize(120, 80);
$img->saveImage("newimages/new07.jpg", 90);
More info here: SmartImage – CodiceFacile.it.