problem with Variable variables

// WORKS // output Array ( [0] => test ) $test[] = 'test'; print_r($test); // DOESNT WORK // output Cannot use [] for reading $var = 'test'; $$var[] = 'test'; print_r($test);

1 Response

solved... ${$var}[] = 'test';

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.