Reputation: 68680
foreach ( $custom_fields as $field_key => $field_values ) {
foreach ( $field_values as $key => $value )
echo $field_key . '<br>';
echo '<pre>' , print_r( $value,true) , '</pre>';
}
Although I'm using print_r
with <pre>
tag, the ouput looks like this:
a:4:{i:0;s:6:"Casual";i:1;s:6:"Serene";i:2;s:6:"Unique";i:3;s:9:"Whimsical";}
shouldn't it be listed vertically with proper indentation? What am I doing wrong?
Upvotes: 0
Views: 295
Reputation: 305
you can use only
$value=unserialize($custom_fields);
echo '<pre>' ;
var_dump($value);
echo '</pre>';
Upvotes: 0
Reputation: 41885
This is a serialized array, use unserialize()
to turn it back to an array again:
foreach ( $custom_fields as $field_key => $field_values ) {
foreach ( $field_values as $key => $value ) {
$value = unserialize($value);
echo $field_key . '<br/>';
echo '<pre>' , print_r($value, true) , '</pre>';
}
}
What it would look like:
http://codepad.viper-7.com/5Rppb3
Upvotes: 5