PHP echoes value without the use of echo
<p>I'm building a table with items in it. What I don't understand is the following:</p>

<p>When I type <code>&lt;td&gt; &lt;?php custom_get_terms('landschapspakket');?&gt; &lt;/td&gt;</code>, it echoes the value of <code>custom_get_terms('landschapspakket')</code>. </p>

<p>What I want to do is use some conditional logic over it to see which value it has, and then echo it. Instead it outputs it even before I type echo. Has it got something to do with the loop? How can I avoid this?</p>

<pre><code>&lt;table&gt;

            &lt;tr&gt;
                &lt;th&gt;Landschapspakket&lt;/th&gt;
                &lt;th&gt;Be nr.&lt;/th&gt;
                &lt;th&gt;Gebiedscode&lt;/th&gt;
                &lt;th&gt;Gebruiksrecht&lt;/th&gt;
                &lt;th&gt;Grond&lt;/th&gt;
                &lt;th&gt;Aantal&lt;/th&gt;
                &lt;th&gt;&lt;/th&gt;
            &lt;/tr&gt;

            &lt;?php $query = new WP_Query(array('post_type' =&gt; $current_posttype, 'posts_per_page' =&gt;'-1', 'post_status' =&gt; array('publish', 'pending', 'draft', 'private'/* , 'trash' */) ) ); ?&gt;

            &lt;?php if ($query-&gt;have_posts()) : while ($query-&gt;have_posts()) : $query-&gt;the_post(); ?&gt;

            &lt;tr&gt;
                &lt;td&gt;&lt;?php custom_get_terms('landschapspakket');?&gt;&lt;/td&gt;
                &lt;td&gt;&lt;?php custom_get_terms('beheerseenheidnummer');?&gt;&lt;/td&gt;
                &lt;td&gt;&lt;?php custom_get_terms('gebiedscode');?&gt;&lt;/td&gt;
                &lt;td&gt;&lt;?php custom_get_terms('gebruiksrecht');?&gt;&lt;/td&gt;
                &lt;td&gt;&lt;?php custom_get_terms('grond');?&gt;&lt;/td&gt;
                &lt;td&gt;&lt;?php custom_get_terms('stuks');?&gt;&lt;/td&gt;

                &lt;?php $edit_post = add_query_arg('post', get_the_ID(), get_permalink(429 + $_POST['_wp_http_referer'])); ?&gt;

                &lt;td&gt;
                    &lt;a href="&lt;?php echo $edit_post; ?&gt;"&gt;Bewerk&lt;/a&gt;

                    &lt;?php if( !(get_post_status() == 'trash') ) : ?&gt;

                        &lt;a onclick="return confirm('Weet je zeker dat je &lt;?php echo get_the_title() ?&gt; wilt verwijderen?')"href="&lt;?php echo get_delete_post_link( get_the_ID() ); ?&gt;"&gt;Verwijder&lt;/a&gt;

                    &lt;?php endif; ?&gt;
                &lt;/td&gt;
            &lt;/tr&gt;

        &lt;?php endwhile; endif; ?&gt;

        &lt;/table&gt;
</code></pre>

<p>If the problem is in the function <code>custom_get_terms()</code>, I'll include the code:</p>

<pre><code>function custom_get_terms($taxonomy) {

    // Get terms for post
     $terms = get_the_terms( $post-&gt;ID , $taxonomy );

     // Loop over each item since it's an array
     if ( $terms != null ){
            foreach( $terms as $term ) {
                 // Print the name method from $term which is an OBJECT
                 if ( $term-&gt;name != null ) {
                     print $term-&gt;name ;
                     // Get rid of the other data stored in the object, since it's not needed
                 } else {
                 }
              unset($term);
            } 
    }
} 
</code></pre>
