I’m sure most people only thing of PHP as a Weblanguage due to be called through a browser. It has however since version 4.3.0 also been possible to use PHP on the commandline – as you do with Perl, Shell scripts and likewise. If you’re using Linux (or an other Unix-like operating system – including [...]
Posts Tagged php
Image sizes and PHP
Sep 23
If you have the GD extension available, you can do a few useful things. One of the simple things is getting an image size is a simple matter. You can either fetch the height and width in seperate variables – or even fetch the height and width in a string pre-formatted for use in an [...]
Reading Exif data with PHP
Sep 22
Within most photos from digital cameras besides the actual image, there’s a little ”information block” call EXIF data. If you have the correct PHP extension installed on your server – the one called ”exif” – it’s pretty easy to read the EXIF data and display them, as you like. First, let’s check if the extension [...]
Simple benchmarks in PHP
Sep 21
If you’re doing some basic profiling of your PHP scripts, the build-in microtime function can help you make some simple benchmarking fast. Here’s a rough example to show you how it could be used. The doSomething function is the function we want to benchmark. 1 2 3 4 5 6 7 8 9 10 11 [...]
Some websites require access control, and sometimes you may need to generate a password for a user. Here’s a simple function that can do just that. The $base-variable contains the characters allowed in the password. The supplied string may be changed, but the selected charaters should exist on all keyboards (as far as I know). [...]
In the book “the Davinci Code” there was a fun little device called a cryptex.. A Cryptex has 6 dials with 6 letters on each, and only one combination producing a word will open it. The most straight forward way to crack it would be to try every combination one by one, but there’s a [...]
A binary clock in PHP
Sep 18
There are some odd functions hidden in PHP. One of them is the decbin function, which makes it easy to convert between decimal and binary numbers. If you’re bore don a rain day, you could use this function to make a simple binary clock, here’s a few lines to get you started: 1 2 3 [...]
A great strength in PHP is that it’s so accessible, that almost anyone can get access to a PHP site and often will download “applications” for their site such as discussion boards, photo galleries and others. While it may easy to download such applications, it often happens that the people trying to get things to [...]
In the book “the Davinci Code” there was a fun little device called a cryptex.. A Cryptex has 6 dials with 6 letters on each, and only one combination producing a word will open it. The most straight forward way to crack it would be to try every combination one by one, but there’s a [...]
We are a fairly large PHP shop at work running some of the largest Danish websites. In a fairly new project, it was suggested that we considered using the Zend Framework to fast track development and piggy back upon some of the components provided by the framework. We looked at it, and said no – [...]