Archive —

"I am putting myself to the fullest possible use, which is all I think that any conscious entity can ever hope to do."

July 30, 2004

I'm back.

I received snail-mail from Michael Wilcox. That was fun. His hand-writing isn't particularly good, but neither is mine. :-)

Here's a pretty cool thing about PHP; you can limit a variable's length in double quoted strings with curly braces. I've often wondered how it can know how many characters after the dollar sign is part of the variable. Now I know; it greedily takes as many characters as it can to form a valid variable name. And a variable name, as any label in PHP, is expressed with the regex [a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*. The reason something like this...

$foo = "15";

echo "Today I ran $foo meters!";
?> is because the parser sees the dollar sign, then greedily consumes characters until it comes to an illegal character. Space is an illegal character in any label, so this works. If you go like this...

$foo = "15";

echo "Today I ran $foom!";

..., however, you run into trouble. It sees the dollar sign, chews characters, then chokes on the exclamation mark, and finds $foom, which is a value-less variable. As said, you can limit the variable's length by enclosing it in curly braces (including the dollar sign inside the braces is optional):

$foo = "15";
$bar = "20";

echo "Today I ran ${foo}m!";

echo "But Jacob ran {$bar}m...";

This works as expected.

Why do Jackie Chan's newer movies suck so much? I mean, why does Tuxedo suck so much? What happened to Legend of Drunken Boxing or Gorgeous? The Rush Hour series is mediocre. I was actually pleasantly surprised by Shanghai Knights. You know what they ought to do? Put Jackie Chan and Jet Li in a warehouse fillled with interesting toys, and throw fifty goons in there with them. Let Jackie play with them for a while, and then send them to Jet, who offs them. That'd be fun to watch.

Allow me to reiterate: You really should be getting Far Cry. As I'm progressing through the game, it gets better and better.

Oh, and one last thing: My HTML tutorial is coming along very nicely.

<< | Previous entry (July 22, 2004) | Next entry (August 2, 2004) | >>
Back to Archive