Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8615607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:25:11+00:00 2026-06-12T05:25:11+00:00

I am trying to create a function which accepts a string and converts it

  • 0

I am trying to create a function which accepts a string and converts it to seolink.
But it is looking very un professional

What will be the better way to optimize it? As the may be too many special characters.

The function lookis like

  function seo_url($title) {
        $titel = substr($title,0,160);

        // Replace underscore with "-" 
        $titel = ereg_replace("_","-",$title);

        // Replace space with "-" 
        $titel = ereg_replace(" ","-",$title); 

       // Replace special characters
        $titel = Ereg_replace ("À", "A", $Titel); 
        $titel = ereg_replace("í", "i", $title); 
        $titel = ereg_replace("ó", "o", $title); 
        $titel = ereg_replace("ú", "u", $title); 
        $titel = ereg_replace("ñ", "n", $title); 
        $titel = ereg_replace("Ñ", "n", $title); 

        $titel = Strtolower (trim($title)); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:25:13+00:00Added an answer on June 12, 2026 at 5:25 am

    The only real way to make it look neater and smaller would be to use an or expression in your regex.

    ie.

    ereg_replace("Ñ|ñ", "n", $title);
    ereg_replace("è|é|ê|ë","e", $title);
    

    This as far as I have seen is the most common way to do this, and also faster I would hasten to guess.

    You can download a character map or create your own for generating the regex string, then store the character map yourself for ease of editing also.

    Then your code would be again much smaller and more robust, as it would load in an external character map, which maps each character to it’s counterpart.

    another solution
    Removing Accented UTF-8 Characters With PHP

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a function which will give me alphabet position when
I am trying to create a function which will take arguments arg1, arg2... then
I am currently trying to create a function which will allow me to pass
I am trying to create a vimrc function which will clean up a line
I'm trying to create a boolean recursive function which accepts 1 parameter only and
I'm trying to create a templated function which accepts an iterable and a function,
I'm trying to create a simple function which returns me a date with a
I'm trying to create a popup for which I am using jQuery's CSS function.Here's
I'm trying to create a function that would append two vectors together, but I
I am trying to create a function as per my requirements. But, when am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.