John is doing the coding
Ooh, am I? Scary. I'm just kind of sketching out code, I'm not necessarily thinking I'll be coding the whole interface thing. I just kind of started playing with it because it's a regular-expression type thing.
I was imagining that, like with quick-edit, I'd give ita a chunk of code to insert into the main body of the Board.
I don't know why one should be worse than the other though, just a matter of where Jon's use single and where he's used double quotes.
Double quotes appear more often than single quotes, so using a single quote to start a link and not closing it properly is likely to affect more of the page than if you start a link with a double-quote and don't close it properly.
Hey, anyone, what's the correct way to get the last item of an array in PHP? I can't seem to see it in the online manual -- should I just use
$array_name[count($array_name)]
or what? It looks clunky.
Hey, anyone, what's the correct way to get the last item of an array in PHP? I can't seem to see it in the online manual -- should I just use
$array_name[count($array_name)] or what? It looks clunky.
$value = end ($array);
There are some nice array navigation commands in PHP.
end($array) resests the internal pointer PHP maintains for each array to the last element of $array and returns the value.
reset($array) resets internal pointer to first element of array, and returns the value of that first element.
current($array) returns the value element of the array to which the pointer is set.
next($array) advances the pointer and returns the value of the resulting element.
each($array) returns the current element, then advances the pointer.
so next() and each() are differentways of navigating an array forward.
prev($array) decrements the pointer by 1, and returns to the new current element.
Also, if you have not used it, look up array_walk(). Basically a for next loop specifically for arrays.
Also, I assume you know that in PHP an array does not have to be accesed by number. You set up an associative array as follows:
$myrRecord=array("LastName"="Horner", "FirstName"="John", "Company"="ThatAussieNetwork");
Then use the extract function as follows:
extract($myrecord);
You will now have a scaler variable LastName with a value of Horner and so forth.
So: echo $LastName $FirstName $Company ;
will return
Horner John ThatAussieNetwork
You don't have to use the extract() function of course. You can access the array directly by index values rather than number.
echo $MyRecord["LastName"] $MyRecord["FirstName"] $MyRecord["Company"] ;
will also display;
Horner John ThatAussieNetwork
Actually, in both cases, it will display
Horner John ThatAussieNetwork
t /nitpick
Okay, something comprehensible flew by and now I have a question...
Quotes? In links? Am I doing something wrong by just using a href and not putting any quotes in there, whether single or double?
test
[edit: Well, I'll be. That's
<a href=http://www.link.com>test</a>
which I didn't think was supposed to work. Anyone know why it does anyway?]
Not using quotes is, IIRC, deprecated. Quotes are recommended (and hopefully soon mandated for the forgetful among us == me) for all attributes. They are currently mandatory for any attribute with a space or other special thingy in them.
t font face="Arial Rounded MT Bold"
for instance, although one should say
t font face="Arial"
and not
t font face=Arial
.
Ah -- I thought they were mandatory for all attributes already.