Title: WPAlchemy Returns &quot;Array&quot;
Last modified: August 20, 2016

---

# WPAlchemy Returns "Array"

 *  Resolved [christopherburton](https://wordpress.org/support/users/christopherburton/)
 * (@christopherburton)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/)
 * I am using WPAlchemy for a custom meta box and I need it to echo
    `<p class="
   description">Here is a description</p>`
 * However, it returns this instead:
    `<p class="description">Array</p>`
 * Here is the PHP I am using:
 *     ```
       <?php
       $meta = $custom_metabox->the_meta('description', TRUE);
       	if ($meta):
              	echo '<p class="description">'.$meta.'</p>'; ?>
       <?php endif; ?>
       ```
   

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Chris Olbekson](https://wordpress.org/support/users/c3mdigital/)
 * (@c3mdigital)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/#post-2877763)
 * The value of $meta is an array. To find out what it contains add var_dump( $meta);
   before the echo and you will get the contents of the array.
 *  Thread Starter [christopherburton](https://wordpress.org/support/users/christopherburton/)
 * (@christopherburton)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/#post-2877768)
 * [@chris](https://wordpress.org/support/users/chris/) Nice! Now how can I strip
   out everything that var_dump($meta); returns and only echo the text?
 *  [Chris Olbekson](https://wordpress.org/support/users/c3mdigital/)
 * (@c3mdigital)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/#post-2877774)
 * Post the result of the var_dump. It it’s indexed it will be something like echo
   $meta[0]; Where 0 is the index of the text.
 *  Thread Starter [christopherburton](https://wordpress.org/support/users/christopherburton/)
 * (@christopherburton)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/#post-2877778)
 *     ```
       <?php
       $meta = $custom_metabox->the_meta('description', TRUE);
       	if (!empty($meta)):
       	var_dump($meta);
              	echo '<p class="description">'.$meta.'</p>'; ?>
       <?php endif; ?>
       ```
   
 * Returns:
 *     ```
       <pre class='xdebug-var-dump' dir='ltr'>
       <b>array</b> <i>(size=1)</i>
         'description' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'This upright formal script was inspired by the 1960's and <a href="http://doyaldyoung.com">Doyald Young</a>.'</font> <i>(length=108)</i>
       </pre>
       ```
   
 * My Goal Output:
    `<p class="description">This upright formal script was inspired
   by the 1960's and <a href="http://doyaldyoung.com">Doyald Young</a></p>`
 *  [Chris Olbekson](https://wordpress.org/support/users/c3mdigital/)
 * (@c3mdigital)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/#post-2877782)
 * Changing the echo line to:
 * `echo '<p class="description">'.$meta['description'].'</p>'; ?>`
 * Should work.
 * To get a better understanding how Arrays work see: [http://php.net/manual/en/language.types.array.php](http://php.net/manual/en/language.types.array.php)
 *  Thread Starter [christopherburton](https://wordpress.org/support/users/christopherburton/)
 * (@christopherburton)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/#post-2877784)
 * Thanks, Chris. I appreciate your time and thanks for the link as well.
 * I removed var_dump() and it seemed to work.
 * Final Code:
 *     ```
       <?php
       	$meta = $custom_metabox->the_meta('description', TRUE);
       		if (!empty($meta)):
              		echo '<p class="description">'.$meta['description'].'</p>'; ?>
       <?php endif; ?>
       ```
   

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘WPAlchemy Returns "Array"’ is closed to new replies.

## Tags

 * [if statement](https://wordpress.org/support/topic-tag/if-statement/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [christopherburton](https://wordpress.org/support/users/christopherburton/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/wpalchmey-returns-array/#post-2877784)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
