Re: [PHP4BETA] re:array navigation

[email protected] (Joseph H Blythe) Tue, 13 Jun 2000 11:49:32 +0930
Newsgroups php.version4
Organization Binary Logic
Message-ID <[email protected]>
Dan wrote:

> Isolate your file name and use associative arrays for your values.
>
> $Next[ "zero" ] = "one.htm";
> $Next[ "one"  ] = "two.htm";
>
> Then use $Next[ $filename ] to get the value.
>
> Here's a function to isolate the filename (no extension), called using the
> "macro" for the filename (which included the path)
>
>   $filename = JustFileName( __FILE__ );
>
>   function JustFileName( $pathAndFile )
>   {
>     $basename = basename( $pathAndFile );
>
>     $pos = strrpos($basename, "." );
>
>     if ($pos)
>       return substr( $basename, 0, $pos );
>     else
>       return $basename;
>   }

Cool thanks,

just what I wanted, for those of you following this thread just remember to
call the constant __File__ inside the file you want to retrieve the filename
from, don't put this in a include file as it won't work as I just discovered.

Joseph Blythe

--
BoldFX / Binary Logic
257 Churchill Road Prospect South Australia 5082
Ph: (08) 8342 0022 Fax: (08) 8342 0155
mailto: [email protected]