I'm not sure I understand what you're trying to accomplish, but wouldn't
array_walk() help you out?


Atenciosamente,
www.softpartech.com.br
Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
[EMAIL PROTECTED]
ExcelĂȘncia em Softwares Financeiros


-----Mensagem original-----
De: Daniel Brown [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 5 de junho de 2008 14:18
Para: Ryan S
Cc: php php
Assunto: Re: [PHP] Execute php commands that are in an array

On Thu, Jun 5, 2008 at 12:34 PM, Ryan S <[EMAIL PROTECTED]> wrote:
> Hey,
> its easier to start with code and then explain:
>
> $t_array[]='chr(rand(97,122))';
> echo $t_array[0];
>
> The above code outputs
> chr(rand(97,122))
>
> How can i execute that above code from the array instead of displaying it?

    Try using create_function().

<?php
    $t_array[] = create_function('','echo chr(rand(97,122));');
    echo $t_array[0];
?>

    Note the manner in which the second parameter is laid-out.  You
must include what you want returned by the dynamic function, complete
with an ending semicolon.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to