fork download
  1. <?php
  2. $var_prefix = 'products';
  3. $var_suffix = '_output';
  4. $var_name = '';
  5.  
  6. //lets create variable first
  7. for($i=1; $i<=50; $i++)
  8. {
  9. $var_name = $var_prefix.$i.$var_suffix;
  10. $$var_name = $i;
  11. }
  12.  
  13. //concatenate them
  14. $products_output = '';
  15. for($i=1; $i<=50; $i++)
  16. {
  17. $var_name = $var_prefix.$i.$var_suffix;
  18. $products_output .= $$var_name;
  19. }
  20.  
  21. print_r($products_output);
  22.  
  23. // your code goes here
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950