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

Home » Imported messages » comp.lang.php » pass arbitrary vars into a func from another func?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: pass arbitrary vars into a func from another func? [message #177518 is a reply to message #177517] Wed, 04 April 2012 20:58 Go to previous messageGo to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma:
Senior Member
J. Frank Parnell schrieb:

> function echoToVar($func,$args = array()){
> ob_start();
> $func($args);
> $ret= ob_get_contents();
> ob_end_clean();
> return $ret;
> }
>
> but i'm not sure how to get the args into the variable func.

You want <www.php.net/call-user-func-array>:

function echoToVar( $func, array $args = array() )
{
ob_start();
call_user_func_array( $func, $args );
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Lead an open source Project "Free Network and Office management system" in php or java
Next Topic: Lead an open source Project "Free Network and Office management system" in php or java.
Goto Forum:
  

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

Current Time: Tue Nov 26 14:38:05 GMT 2024

Total time taken to generate the page: 0.04234 seconds