Encode $title question

Discussion in 'PHP' started by Silver89, Nov 6, 2006.

  1. #1
    Ok i use this on my site,

    rawurlencode($titlef)

    but i need to

    echo $titlef

    with just letters, so if the title included -^&*£$.,/ it would remove them and just have letters and spaces.

    Is there anyway you can do this in php??

    thanks
     
    Silver89, Nov 6, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    $title = preg_replace('/[^a-z0-9\s]/i', '', $title);
    
    Code (markup):
     
    nico_swd, Nov 6, 2006 IP
  3. Silver89

    Silver89 Notable Member

    Messages:
    2,243
    Likes Received:
    72
    Best Answers:
    0
    Trophy Points:
    205
    #3
    ah great thanks :)
     
    Silver89, Nov 6, 2006 IP