Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.53 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Can I display the array key and value without using foreach?
  2. $down = array (
  3.     "file.rar" => $l->get()->fileDesc(),
  4.     "file1.rar" => $l->get()->clientDesc()
  5. );
  6.        
  7. foreach ( $down as $key => $value )
  8.      $data .= $key . ' = ' . $value . '<br/>';
  9.        
  10. //echo $data;
  11.     file.rar = File Description One
  12.     file1.rar = Client Description
  13.        
  14. function print_array($down) {
  15.    $data = '';
  16.    foreach ( $down as $key => $value )
  17.       $data .= $key . ' = ' . $value . '<br/>';
  18.    return $data;
  19. }
  20.        
  21. <?php
  22.   $data = print_r($down, true);
  23. ?>