Related Content
Generating Colour Palettes From Images In PHP
A common web design pattern is to incorporate an image into the design of the page. This creates a tighter integration with the image and the rest of the page.
The main issue in designing a page around the image is that the colours of the page must match the image. Otherwise this creates a dissonance between the image and the styles of the site.
Validating XML Files With XML Schema Definitions In PHP
XML is a useful format for configuration, data storage, and transmitting data from one system to another. As a human readable format that can be easily read by machines it quickly gained favor in lots of different systems as a mechanism for data storage.
Creating A Character Bitmap In PHP
I was watching a video from NDC by Dylan Beattie the other day on The Story of Typography and a particular section stood out to me.
Approximating Pi Using A Circle And A Square
Pi day was a few weeks ago, but I came across this simple approximation of pi recently and decided to put together an example in PHP since it seemed pretty simple.
This approximation of pi centers around a real world example, but we can simulate this using some code.
Drawing A Parabolic Curve With Straight Lines In PHP
A parabolic curve is a type of curve where every point is an equal distance from a focal point. There a number of different way to generate this sort of curve using math, but one of the simplest is to use straight lines to create the illusion of the curve.
Recreating Spotify Wrapped In PHP
I quite like the end of the year report from Spotify that they call "Wrapped". This is a little application in which they tell you what your favorite artist was and what sort of genres you listened to the most during the year.
Comments
Submitted by Indy on Sun, 02/17/2008 - 12:25
PermalinkI know about XML parsing in PHP. Here is how to do the same sort of thing with the XML engine in PHP.
Just expand the startElement function to include whatever you are looking for.
Just out of interest I did some timing of the two different ways of getting at the data; XML or regular expressions. To ensure that nothing odd was going on I only downloaded the data once at the top of the script and then ran the two ways 10,000 times each on the same data. I didn't print anything off just in case that effected things, but I left in all of the if statements. Here is the average times:
Average regular expression time 0.00013191080093384 Average XML parse time 0.00088728330135345
There isn't much in it but it looks like regular expressions are a bit quicker than XML parsing. Unless I have done something wrong with along the way?
Submitted by giHlZp8M8D on Wed, 02/20/2008 - 15:04
PermalinkSubmitted by Marty Martin on Tue, 03/25/2008 - 14:52
PermalinkSubmitted by giHlZp8M8D on Tue, 03/25/2008 - 20:01
PermalinkSubmitted by Mohamed Mahmoud on Wed, 03/03/2010 - 17:13
PermalinkSubmitted by giHlZp8M8D on Thu, 03/04/2010 - 09:00
PermalinkSubmitted by rhoula on Wed, 08/15/2012 - 18:00
PermalinkJust create a script like I have above (either via regex or xml parsing) but save the information into a database table or something.
All you need to do then is create a cron job that will run the script once a day. Something like the following would do this:
* * 23 * * php /path/to/script.php
Submitted by giHlZp8M8D on Thu, 08/16/2012 - 09:08
PermalinkAdd new comment