Concatenation php variables: -


i have problem in creating variable in loop , accessing third variable value, did try many way don't know how that.... code is..

$rand_1 =       random_username($_post['txtuser_name']); $rand_2 =       random_username($_post['txtuser_name']); $rand_3 =       random_username($_post['txtuser_name']);  $username   =   "";  for($i=1; $i<=3; ++$i){    $name   =    "rand_".$i;    $username .= $name."<br />"; }  echo $username; 

any suggestion.....

try $$name, variable variable.

still, when see var_1 etc, means should using array.

then make code...

$rand = array();  foreach(range(0, 2) $index) {     $rand[] = random_username($_post['txtuser_name']); }  $username = join('<br />', $rand) . '<br />';  

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -