CodeIgniter Forums
concat two php variables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: concat two php variables (/showthread.php?tid=13438)



concat two php variables - El Forum - 11-22-2008

[eluser]manash007[/eluser]
I want to concat 2 php variables which will indicate single name.....

EX:
$i=1;
$array.$i[]="something";

which name will be $array1,which is an array........
But this is not working......
How can i do this??????
Anyone can help??????????????


concat two php variables - El Forum - 11-22-2008

[eluser]davidbehler[/eluser]
What does your array look like? How many entries does it have?
Accessing $i the way you do makes no sense to me, as $i is an integer and no array.

Could you elaborate on what you try to do exactly?


concat two php variables - El Forum - 11-22-2008

[eluser]Frank Berger[/eluser]
$i=1;
$array = 'array'.$i;
${$array}[]='something';

The manual is your friend:
http://php.net/manual/en/language.variables.variable.php

Cheers
Frank


concat two php variables - El Forum - 11-22-2008

[eluser]manash007[/eluser]
thanks .......