RE: [PHP] Calling function on the same line?
| From: | Andrea Giammarchi | Date: | Sat, 28 Mar 2009 18:09:16 +0000 |
| Subject: | RE: [PHP] Calling function on the same line? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290796@lists.php.net to get a copy of this message | ||
How do you pass that string?
If you replace via other file, you do not need to use strings, just call the function.
If you are parsing a variable, you do not need the inline ...
$_GET['function']("a", "b", "aaa");
if the query string is &function=str_replace
I do not get the problem at all specially now that you do not need variables ... and if you will end
up with eval, you are doing something wrong.
Regards
Date: Sat, 28 Mar 2009 17:09:15 +0300
Subject: Re: [PHP] Calling function on the same line?
From: danondaniel@gmail.com
To: an_red@hotmail.com
Thank you for trying to help, But I am trying to do it without variables..... =[
On Sat, Mar 28, 2009 at 3:51 PM, Andrea Giammarchi <an_red@hotmail.com> wrote:
I miss the utility to do stuff like that ... seriously ... but in any case:
<?php
echo ($f = 'str_replace') ? $f("a", "b", "aaa") : null;
?>
where echo is optional.
Regards
> Date: Sat, 28 Mar 2009 15:26:18 +0300
> From: danondaniel@gmail.com
> To: php-general@lists.php.net
> Subject: [PHP] Calling function on the same line?
>
> Is there any way to do something like:
>
> <?php
> ("str_replace")("a", "b", "aaa");
> ?>
>
> ?
>
> One of the problems that I must keep "str_replace" on the same line...The
> only solution I see is call_user_func, but I would like to know if you guys
> might have a clue =]
> Tried looking on the manual, sadly didn't found anything
>
> Thanks, Daniel
_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx