| | |
variable array
Thread Solved |
I have a large multidimentional array that I am looping through to change it's structure and theoretically this function will work accept the "variable array" part. And maybe that's not the right name for it as I have checked my resources and cannot come up with the right syntax for it but theoretically, I think I should be able to do it.
If you know what a variable variable is:
I am trying to do the same thing with an array:
Does that make sense?
If you know what a variable variable is:
PHP Syntax (Toggle Plain Text)
$variable = "blue"; $$variable = "red"; //what you get is $blue = "red";
I am trying to do the same thing with an array:
PHP Syntax (Toggle Plain Text)
$variable = "blue"; $$variable[] = "red"; //what I want is $blue[0] = "red";
Does that make sense?
the syntax you are looking for is:
PHP Syntax (Toggle Plain Text)
$variable = "blue"; ${$variable}[] = "red"; //print array to see if it worked (did for me) print_r(${$variable});
![]() |
Similar Threads
- send session variable in an array (JSP)
- C++: compile error "subscripted value is neither array nor pointer" (C++)
- Complete shuffle of an array (C++)
- filling variable with array from vb code. (HTML and CSS)
- seg fault when accessing the array (C)
- Using a variable as an array's index? (C)
Other Threads in the PHP Forum
- Previous Thread: Including external content
- Next Thread: why is this language so insecure?
Views: 1004 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
access ajax apache array beginner box broken buttons cakephp check checkbox class cms code cookies css curl database date directory display download dropdown drupal dynamic echo email error file files folder form forms function functions header href htaccess html image images include insert ip java javascript joomla jquery limit link login lookup loop mail menu methods mlm mod_rewrite multiple mysql order parse password paypal pdf php problem query radio redirect regex remote script search security select server session sessions shopping soap sort sorting source sql string table unicode update upload url user validate validation variable video web website wordpress xml






