Title: Open PHP result in a php echo code
Last modified: August 19, 2016

---

# Open PHP result in a php echo code

 *  [jenny86](https://wordpress.org/support/users/jenny86/)
 * (@jenny86)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/open-php-result-in-a-php-echo-code/)
 * Hello,
 * guys you are so fantastic. Maybe you know a solution for this problem…
 * I am using the following code to read out the meta field named “GalleryID”.
 *     ```
       <?php
   
       function meta_galleryid() {
              global $id, $post_meta_cache;
   
               if ( $keys = get_post_custom_keys() ) {
                       foreach ( $keys as $key ) {
                               $values = array_map('trim', get_post_custom_values($key));
                               $value = implode($values,', ');
                               if ( $key == 'GalleryID' ) {
                                       echo "$value";
                               }
                       }
               }
       }
       ?>
       ```
   
 * This works fine. The result is for example “1” or “2” if I enter these numbers
   in the meta field.
 * I am using the NextGEN Gallery and by using the code <?php echo nggshowgallery(
   1,450,450); ?> the gallery with the ID 1 opens. I want to connect now this NEXTGen-
   Function with the display of the meta galleryID.
 * I thought that the following code will work:
 *     ```
       ...
       if ( $key == 'GalleryID' ) {
       echo "<?php echo nggshowgallery($value,450,450); ?>";
       ...
       ```
   
 * But it do not work… Also this do not work:
 * `<?php echo nggshowgallery(<?php meta_galleryid(); ?>,450,450); ?>`
 * Why not? What would be the solution? Is there any possibility to open a php within
   a php??
 * Thanks for your help guys
    Jen

Viewing 1 replies (of 1 total)

 *  Thread Starter [jenny86](https://wordpress.org/support/users/jenny86/)
 * (@jenny86)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/open-php-result-in-a-php-echo-code/#post-696487)
 * Does really nobody wants to help me?!?! 🙁

Viewing 1 replies (of 1 total)

The topic ‘Open PHP result in a php echo code’ is closed to new replies.

## Tags

 * [NexGen Gallery](https://wordpress.org/support/topic-tag/nexgen-gallery/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [jenny86](https://wordpress.org/support/users/jenny86/)
 * Last activity: [18 years, 2 months ago](https://wordpress.org/support/topic/open-php-result-in-a-php-echo-code/#post-696487)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
