[thelist] 404 hack: thanks for a great idea!
Ben Henick
persist1 at io.com
Mon Mar 12 19:49:22 CST 2001
The past week, I've been building a Weblog:
http://www.io.com/persist1/log.php
I struggled over how to give each entry its own URL until this morning,
when the content-negotiation method used on evolt.org came to mind.
Putting the functionality together was a snap - or at least as much a snap
as it could be, given that until a week ago I'd done as little of my own
PHP as I thought I could get away with at the time.
So, to Dan and anyone else who feels they deserve the credit: thanks.
<tip type="PHP arrays vs. JavaScript arrays" author="Ben Henick">
While in JavaScript arrays can often be accessed by index:
This_Array[3] = "whatever";
or by key (especially in the DOM tree):
document.images["Nav3"] = "whatever.gif";
in PHP, many of the arrays you'll find yourself working with are not
nearly so versatile.
It's still easy in PHP to retrieve the length of an array, regardless of
its type:
i < count($this_array);
...but you'll find yourself working with while loops far more frequently
because many defined functions return arrays by key and not by index:
while(list($current_key,$current_entry) = each($this_array))
{ ... }
</tip>
...for what it's worth. YMMV...
--
Ben Henick
Web Author At-Large
http://www.io.com/persist1/
persist1 at io.com
"Are you pondering what I'm pondering, Pinky?"
"I think so, Brain, but... (snort) no, no, it's too stupid."
"We will disguise ourselves as a cow."
"Oh!" (giggles) "That was it exactly!"
More information about the thelist
mailing list