Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

2008-05-05

The pros from Dover

Is this sounding like one long rant about php?

I wonder why...

Today's rant is about the quality of PHP documentation. I've taken to using the official PHP documentation on the official website. Fairly often I am disappointed because there are missing parts: the developers wrote some code quickly and didn't bother to document. Odd for an official site, but okay.

So right now I am looking for info on doing HTTP digest authentication in php. There is a page about it that provides some examples that simply don't work. The regex for parsing Authorization headers is defective and none of the solutions people have offered up in the comments have helped me at all...

Fine.

The funny thing is that everyone insists on using regexes. I like regexes just fine, and with Perl I used to consider myself reasonably good with them. Anyhow, the consensus seemed to be that you needed a good regex. After screwing around for awhile, I was about to write my own solution using explode and substr and a lot of strpos(). But it was getting late...

So, after wasting an evening thinking that there was something I wasn't getting, I decide to look around for a library. There isn't much that jumps out at me right away, but I end up finding Auth HTTP which extends the Auth class.

I don't want to install Auth (trying to go light) but I download Auth HTTP to look at how they parse the Authorization header. First of all, I am impressed by how clean the code is. Then I find my function, and guess what: explode, substr, strpos.

2008-03-24

Testing... Testing...

Now that I have started using a test suite -- this one, in fact -- my life has improved. At least I can see why PHP is not doing what I want it to.

There is something very satisfying about testing as you go. It definitely improves the modularity of your code.

strlen!

So strlen is just way more intuitive than length()!

Obviously

Obviously, I'm using php4. Because I have to.

If I could use php5, I would.

If I could use (almost) anything besides, php, four or five, I would. Including languages I don't even know but would love to learn. Python, for example. That would be fun.

Hey...

This is obviously my first post here. This blog is going to be about programming. Right now it is going to be about why I hate the php programming language. That is why I decided to create this blog today. I would have eventually done it anyway, but it would have been later. So there you are. I'm going to publish this and then go see what this thing looks like. Back with some rants quickly.