FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Dot in array key name
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Dot in array key name [message #169971 is a reply to message #169966] Sat, 02 October 2010 13:19 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 10/2/2010 2:30 AM, Martin wrote:
> Hi.
>
> I'm debugging a script where i load images if they haven't already
> been loaded and then draw them onto another image.
> (All images are PNGs).
>
> $icons=array();
>
> $icon_name='myicon.png';
>
> if($icons[$icon_name]){
> // the image has already been loaded
> $icon=$icons[$icon_name];
> } else {
> $icon=imagecreatefrompng($icon_name);
> $icons[$icon_name]=$icon;
> }
>
> I'm trying not to load an image more than once if it is required more
> than once.
>
> Anyway - i have a bug where sometimes the wrong image is used and
> wondered whether the dot in the image's filename is invalid syntax for
> an array key name?
>
> I've searched a while but get lots of irrelevant results - if anyone
> can give me a quick yes or no answer it'd be appreciated.
>
> Martin.

No, there is not a problem with a period in an array key. It's just
another character.

Your problem lies somewhere else.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Inserting into associative array
Next Topic: php ide with checkpoint restart is there?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 07:00:18 GMT 2024

Total time taken to generate the page: 0.05076 seconds