Dave wrote On 06/07/2008 09:54 PM:
> Hi guys,
>
> first post :)
>
> my question: is it possible to have dynamic variable names, I mean
> something like this:
>
> for($i=0;$i<x;$i++){
> $y_$i = blabla;
> }
>
> in other words I want the number of the loop to be displayer in the
> name of the variable.
>
> Thanks for help
Hi,

You can test this syntax :

$y = 'test';

for($i=0; $i < 3; $i++)
{
   ${$y.'_'.$i} = 'blabla';
}

echo $test_0;

it should echo : blabla

voila :)

-- 
Simon COURTOIS
{EPITECH.} tek4 | (LINAGORA) Developer | [ADITAM] Project Manager
10, rue Brillat-Savarin 75013 Paris | 01 45 42 72 30 - 06 72 44 67 81
http://www.happynoff.fr


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to