I have this php array:
$items = array (
"Item 1" => "Value 1",
"Item 2" => "Value 2",
"Item 3" => "Value 3"
);
And I am wondering if there is an elegant PHP function I have never heard of to do the same as this:
$output = "";
foreach ( $items as $key => $value ) {
$output .= sprintf( "%s: %s\n" , $key , $value );
}
echo $output;
Which of course, would output:
Item 1: Value 1
Item 2: Value 2
Item 3: Value 3
Also, what do you call that? Deserialization?
var_dumporprint_r?$outputto the current value every time.echo '<pre>'; print_r(array); echo '</pre>';