I want to display an array and on the last value, I want it to be displayed completely different from the rest. Is there any way to do that???
Ofcourse...
Just write a function which shows the array:
for($i=0;$i<count($array)-1;$i++){ echo $array[$i]; } echo $array[count($array)-1];
So you can change the last echo as you wish.
Is this what you mean?😕
Hi Grey Boy
Tom's reply is good. The way I did it was to use array_pop(), i.e.
$last_item=array_pop($array); // pick off last item for ($i=0; $i<count($array); $i++) // stop before last one { echo $array[$i]; } echo $last_item; // add your display stuff
HTH
Norm
Ofcourse that's an option too 😉
The only problem is that you now don't have the last item in the array anymore. That may be a problem if you're using the array multiple times on the same page.
Yes, indeed, hadn't thought of that.
Thanks guys, that got me a lil futher. Now, I need to know how to call the last value where the key is a text string rather than a number.
This is what I get for staying up all night!!! I cant think worth a damn!!!
Ok, I figured it out and I got my script working!!!
Thanks guys for the help!!!
Tip for youre website: Don't use Times New Roman text... I hope you just haven't finished the css style?
😉
Thanks Tom. I have the CSS scattered amongest the individual pages, but when I have time to put them all into a seperate file, I will change the font. I usually use arial, but I guess I wasnt paying any attention.