Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
Zamijena hrvatski slova

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
pegasus275



Joined: 26 Oct 2005
Posts: 13

PostPosted: 06.10.2006 11:59    Post subject: Zamijena hrvatski slova Add user to your forum ignore list Reply with quote

Kako mijenati naša slova npr čć sa c

moze li sa str_replace

mislim da ovo ne bih radilo str_replace("čć","c",$var);
Back to top
View user's profile Send private message
zvone



Joined: 09 Sep 2003
Posts: 160
Location: Zg

PostPosted: 06.10.2006 14:33    Post subject: Add user to your forum ignore list Reply with quote

Ti misliš da ne bi radilo, a zašto ne probaš. I zašto ne replaceaš znak po znak ovako:

<?php

$var = str_replace("č","c",$var);
$var = str_replace("ć","c",$var);

?>

_________________
Odin's descendant
Back to top
View user's profile Send private message
retro_one



Joined: 16 Sep 2003
Posts: 880
Location: DUBRAVA.

PostPosted: 06.10.2006 15:21    Post subject: Add user to your forum ignore list Reply with quote

@pegasus: RTFM

Quote:
If search is an array and replace is a string, then this replacement string is used for every value of search.


Code:
<?php
// Provides: <body text='black'>
$bodytag = str_replace("%body%", "black", "<body text='%body%'>");

// Provides: Hll Wrld f PHP
$vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
$onlyconsonants = str_replace($vowels, "", "Hello World of PHP");
?>

_________________
Just your average eccentric programmer.
Back to top
View user's profile Send private message
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 06.10.2006 16:46    Post subject: Add user to your forum ignore list Reply with quote

Code:
$mytext = 'česmošućuračuđuška žušuflaj';

str_replace(
   explode(' ', 'č ć ž š đ Č Ć Ž Š Đ'),
   explode(' ', 'c c z s dj C C Z S Dj'),
   $mytext)
   );

alternativno (ako koristiš ISO-8859-2):
Code:
strtr(
   $mytext,
   'čćžšđ',
   'cczsd'
   );

...(odnosno UTF-8 ) :
Code:
strtr(
   iconv('UTF-8', 'latin2', $mytext),
   iconv('UTF-8', 'latin2', 'čćžšđ'),
   'cczsd'
   );
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group