Thanks, Micha! My earlier imagined way didn't work, not
surprisingly!
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Michael Fesser" <netizen@gmx.de> wrote in message
news:k7n4q39jppjrpi3sn2bcqvgdfu2s7g7geo@4ax.com...
> .oO(Murray *ACE*)
>
>>I am building a mini-app using an API into another
back-end system. To
>>extract data from this system, I can use PHP lines
like this -
>>
>>$stats = $q->campaignStats($cid);
>>
>>where the variable "$q" has been previously loaded
with values.
>>
>>What I want to know is - can I programatically
generate this line? What
>>I'd
>>LIKE to do would be something like this (analogous to
the way that DW
>>builds
>>query strings) -
>>
>>$statsQuery = 'campaign' . $command . "($cid)"
>>
>>and then I can set $command to any of a number of
different values, e.g.,
>>"ClickStats", "Bounces", "Unsubscribes", etc.
>>
>>Now - what I don't know how to do is to then
reference this string in a
>>way
>>that executes the command, as I'm fairly sure that -
>>
>>$stats = $q->$statsQuery; would fail (but I'm
going to try it of course).
>
> The function name can be taken from a variable, so you
can use something
> like
>
> $statsQuery = "campaign$command";
> $stats = $q->$statsQuery($cid);
>
> For other ways of calling such "dynamic" functions have
a look at
> call_user_func() and call_user_func_array() if
necessary.
>
> Micha