Floating point numbers - what else can be done?
242266
Avoiding errors In a recent article here in The Register we saw some of the problems that result when floating point numbers are misused or chosen inappropriately.â¦
693784
Letters And just how long is a piece of string?
126500
DevShed is starting up another new series today, this time looking at the DirectoryIterator methods out of the Standard PHP Library functionality.   Because this class might be handy to use in projects where handling directories is a must, in this new series I'll be taking a close look at some of its most important methods. We will explore these methods appropriately in conjunction with the corresponding code samples.    They introduce the class, noting why it's handy to use and where's the best place to use it - including an example. They get into a bit more detail, looking at the key() and current() methods as well as using the rewind() method to reset the pointer for the directory.
540625
Keith Devens says:  It turns out it's much faster to build large strings from many smaller strings by concatenating them onto one string than it is to append to an array repeatedly and then join that array into a string. I timed it and was surprised by the results.  But that's not Secret #812. Read what Joshua Paine has to say in that post's comments.
400016
Launching off from this previous post on the Stubbles Blog, two more posts (from two other developers) have been posted on the same subject:  In this new post, Frank Kleine takes things a step further and talks about the same kind of type hinting but for more types - including arrays and objects. Examples of how he'd expect things to work followed. The other post is from Stephan Schmidt again and varies slightly off into the world of Namespaces to be included in PHP6 along with the use of annotations.  Be sure to check out the comments on each for some more interesting tidbits...
14108
On the SitePoint PHP Blog today, Troels Knak-Nielsen has written up a post concerning the current state of functional programming in PHP.   With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealized potential hidden within?   He looks at a few different aspects of functional programming and sees how well PHP fits into them (like dynamic dispatch, binding a variable to a function and an implementation of currying for a function). This last option is the only "true" functional feature that PHP can realistically handle.
418285
Apparently PHP5 RC3 is going to be the last release candidate. This is supposed to be coming out at the end of this week, so PHP5 will probably be released next month.  It's a bit like looking through a window into a candy store. The sweetener I most look forward to is the improved object assignment semantics.
666908
Stoyan Stefanov has a fun little post showing an interesting formatting trick to make reading arrays/hashes easier:   Writing readable code means proper indentation. Usually you'd tab (or use 2 or 4 or 3 spaces) after every curly bracket. [...] Same goes when you have a bigger hash/object sort of thing [...] But recently, inspired by Firebug's Net panel way of presenting header information, I tried aligning the keys to the right in addition to aligning the values to the left.   Check out the entry for examples of each of these techniques and see which might fit your programming style the best. Personally, the align right style looks nice but could be more of a pain than it's worth to force my editor into.
634435
Andrei Zmievski has posted something new to his blog today about a feature of PHP6 that's finally been hammered down - HTTP input (request) decoding.   There have been no fewer than 4 different proposals floated before, but this one combines flexibility, performance, intuitiveness, and minimal architectural changes, and has only a couple of small drawbacks. Let's take a closer look.   He details the functionality - what it is, what's been decided on, and the advantages of the method. The basic approach is a "lazy" one where PHP will only store the request when it comes in, no filtering or anything, until you want to do something with it (i.e. get it via $_GET, $_POST, etc). When the request for data is made, PHP looks at the encoding settings and formats the data accordingly.   Advantages he mentions for this method include removing the guess-work on PHP's part for which encoding the request is and that it removes some of the overhead by not processing the data until it's actually needed.
687228
On his blog, Phil Thompson lists seven PHP functions that "saved his life" when developing his apps:   From time to time, I've struggled with minor pieces of coding for what seems like an age and then I've discovered PHP has a ready-made function whose express purpose seems to be to fix my exact problem. Today, I name and honour those PHP functions which saved my life, my career and my sanity.  Functions that made the cut include:  number_format array_values isset() array_diff()   He has his own reasons for each - all of them being handy little functions that fill a specific niche in PHP's vast array of abilities.
516111
Nick Halstead continues the "Programming Tips" series on his blog today with tip number nine (a very handy tip indeed) - using debug_backtrace from Larry Garfield.   Despite the proliferation of debugging tools, especially real-time debuggers, "debugging by print statement" remains the most common form of debugging in most programming languages.   An example of its use is included by way of a debug() function that returns the message it a bit friendlier format.
347638
In a new post on his blog, Kore Nordmann takes a look at a feature that's been around a long time (first introduced in a message board application) - BBCodes.   The discussion on my blog post "Do not use regular expressions for parsing" ended in a discussion about BBcodes in general. I just used them as an example to demonstrate why it it is impossible to parse such a language with regular expressions - and mentioned in a subclause, that I don't see any sense in using them at all.   He looks at some of the myths surrounding them and their use (more secure, easier to use, safer than HTML) and gives some reasons for making teh choice of HTML over them.
619712
Excel 2007 has a bug with the display of floating-point values, a Microsoft developer confirmed on his team's blog yesterday. BetaNews confirmed the bug's existence, which leads to some values in floating-point multiplication to be "rounded" to incorrect values.
641397
The other day Tim Bray wrote up an interesting piece on java.util.regex.  I sent him off a quick email detailing my past experiences  and he just blogged his feedback .  "Well... yeah, but here's a story. I was kind of surprised at the results on my OS X box, so I took the code and data over to a nearby Windows XP box and got similar results, so I took 'em to a Debian-stable box I had handy and once again, about the same story. "  "Only, not quite the same. Because it was Perl 5.8.1 on one box and 5.8.3 on another and 5.6.1 on the third, and the i18n/regex code was slightly different in each version, and no two of them gave quite the same results. "  "Now, I'll grant that Unicode/i18n is one ...
362505
On Pierre's blog today, there's a release announcement about the "long awaited for" version of his Filter extension - version 0.1.0.0.   This release will be included in the upcoming PHP 5.2.0RC3, which is likely to be the last RC. Please report any trouble you find, and post your feedback (here, on the pecl-dev mailing list or in the issue tracker), it will help provide the best possible extension in the 5.2.0 release. A stable filter release should still hit the road this year.   Feature additons for this release include an input_get_args method, support for PHP's pcre expressions, JIT support, and support for custom decimal spacers. Several behaviors were changed as well, including when a value is FALSE or NULL, updates to the integer/float parser, and the default filter now being set to "raw".   You can get the complete listing of updates on the project from the Changelog and check out the project and all of its documentation on it's PECL homepage.
703914
On his blog, Stuart Herbert has a quick tip showing how to mimic a feature of Ruby on Rails:   I'm still working on the next article in my series looking at PHP on servers, so in the mean time, check out this simple way to emulate Ruby's nice way of handling separate getter, setter and state query methods in PHP.   He admits his example isn't as elegant as the Ruby method, but it does get the job done. Code for the method is included in his post ready for cut and pasting.
483176
To fully appreciate the functionality of dltypeof(), you should be familiar with the JS operator it attempts to replace: typeof() and the frustrations associated with the limitations of the typeof() operator. By Peter Belesis. 0830