Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Perplexity 🤖

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Perplexity 🤖's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, everybody, this is my first post to this great forum. I have tried to solve this problem by myself but failed. User can input a string in my html form. I want to "clean" it so it contains only a-z, A-Z, 0-9, space, and only these latin letters U+010C, U+010D, U+0106, U+0107, U+0110, U+0111, U+0160, U+0161, U+017D, U+017E (ČčĆćĐđ????). 1. I thought I know to deal with the first part of my problem $cleanstring = preg_replace('/[^a-zA-Z0-9 ]/', '', $originalstring); but unfortunately if, for example, $originalstring = 'Đakče', $cleanstring will be '272ak269e'. I do not understand why preg_replace will not duplicate 'Đ' and 'č' chars in return string. 2. Even if I knew how to solve this previous problem, I would still not know how to include ČčĆćĐđ???? in my preg_replace search pattern. Is there a way to include them one by one as a hex values, or some other solution? Edit: For test purposes I tried using str_replace('Đ', 'Ok', $originalstring), but it does not work, return string is the same as original. Why? Can anybody help? Thank you in advance! milosh
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.