Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: filtering text

  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts

    Question filtering text

    Hi im using this code right here to remove the word "(text)" from ever appearing in my seo tag links.
    Code:
                <?php
                $tobeOmitted=array('(text)');
                $tagss = explode(" ", $link['display_name']);
                foreach( $tagss as $key => $value){
                if(!in_array($value,$tobeOmitted))
                echo "<a href=\"/search/$value\"/>$value</a> ";
                } ?>
    What im trying to do now is filter underscores "_" from ever appearing. So lets say there is the text link showing as "text_link". What can i add to remove the "_" from the text and make "text_link" explode into 2 seperate links such as "text" and "link"? the word "text_link" is just an example and that word could be any random words. Can somebody help me?
    Last edited by cosmicsea; 03-17-2010 at 12:19 PM.

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Code:
    $tagss = explode(" ", str_replace('_', ' ', $link['display_name']));

  • Users who have thanked MattF for this post:

    cosmicsea (03-17-2010)

  • #3
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by MattF View Post
    Code:
    $tagss = explode(" ", str_replace('_', ' ', $link['display_name']));
    Thanks alot.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •