Hi Matt,
You can use the curly brackets {} for this
For example $databaseresult->{$prefix.'_fade'} == 1
Cheers,
Stig
matt_thomson wrote:
> Does anyone know if this is possible?
>
> //$prefix equals 'main' or 'lightbox', both strings
> function writeJs($prefix)
> {
> //if the function is called with 'main' as the
> //prefix, I want to check the
> //var $databaseresult->main_fade, if
> //'lightbox' is the prefix, I want to check the
> //var $databaseresult->lightbox_fade
>
> //this will throw an error, but it shows what I mean
> if($databaseresult->.$prefix.'_fade' == 1)
> {
> //write some js for the main gallery
> //or lightbox gallery
> }
> }
> //I call this function twice, once to write some js for a gallery,
> //and another time to write some similar js for the lightbox bit
>
> Thanks,
>
> Matt.
> >
>
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---