Subscribe RSS

Archive for 2006

PHP question Feb 16

Apologies for the complete geekery of this post.

I have some data in a file and I would like to manipulate it using PHP to produce an HTML output. Not being very familiar with file-handling, can anyone suggest how I get the data into a usable form?

The input file contains (almost) fixed width data in the form:

texttexttexttexttext #####
textext  ###
texttextext ###

where texttexttext is a string and #### is a number.

I’d like to import the file into a two-dimensional array, the first part containing the text (trimmed of spaces to the right), with the second containing the number (with any whitespace either side trimmed). The text field is 60 wide and the number field is 8 wide.

Does anyone have any handy code to do this, please? I’ve had a Google and can’t find what I’m after. It’s not so much the trimming as getting the two bits of data into different parts of the array. Thanks.

 | 7 Comments
When bar charts attack Feb 14

Hughes: “Under my leadership, the laws of statistics will be turned on their head.”

Simon Hughes bar chart

(With apologies to Rob.)

 | 3 Comments
BlogCode has arrived Feb 14

A new blog interlinking tool has landed – BlogCode. See the box in my sidebar for more. (Via.)

 | Comments off
FAO: Scottish bloggers Feb 13

If you’re a Scottish blogger or a blogger in Scotland, consider adding yourself to the Scottish blogs directory and/or coming along the next blogmeet in Edinburgh on Saturday 18th February.

 | Comments off