You could add dynamic keys & values to an array. Then just extract() the array:
$a_vars = array(); for ($i = 0; $i < $x; $i++) { $a_vars["foo_${i}"] = "bar_${i}"; } extract($a_vars); You now have variables $foo_0, $foo_1, .. $foo_[x-1] available. On Sat, Jun 7, 2008 at 3:54 PM, Dave <[EMAIL PROTECTED]> wrote: > > 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. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---