Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-14-2009, 12:29 AM   PM User | #1
kamkam
Regular Coder

 
Join Date: Dec 2006
Posts: 306
Thanks: 24
Thanked 0 Times in 0 Posts
kamkam is an unknown quantity at this point
replace the empty space with ',' from unicode

Hi;
I am trying to replace the empty space with the ',' from a string which group by unicode.
I want to have result as following;
锕=錒','锿=鎄','皑=皚','嗳=噯','蔼=藹','霭=靄','爱=愛','嫒=嬡

but my code does not do anything,just give me like the following,could anyone help me, please, thanks.

锕=錒  锿=鎄  皑=皚  嗳=噯  蔼=藹  霭=靄  爱=愛  嫒=嬡

PHP Code:
<?php
 mb_internal_encoding
("UTF-8");
 
$search=" ";
 
$replace="','";
 
$string="锕=錒  锿=鎄  皑=皚  嗳=噯  蔼=藹  霭=靄  爱=愛  嫒=嬡";
 echo 
str_ireplace($search,$replace,$string);
?>
kamkam is offline   Reply With Quote
Old 03-14-2009, 01:08 AM   PM User | #2
sea4me
Regular Coder

 
sea4me's Avatar
 
Join Date: Jan 2009
Location: Damn, I don't know...
Posts: 389
Thanks: 11
Thanked 27 Times in 26 Posts
sea4me is an unknown quantity at this point
Here:

PHP Code:
<?php 
 $search
=" "
 
$replace="','"
 
$string="锕=錒  锿=鎄  皑=皚  嗳=噯  蔼=藹  霭=靄  爱=愛  嫒=嬡"
 echo 
str_ireplace($search,$replace,$string); 
?>
The spaces on the string isn't the same as the ones you have in search...
__________________
sea4me is offline   Reply With Quote
Old 03-14-2009, 01:26 AM   PM User | #3
kamkam
Regular Coder

 
Join Date: Dec 2006
Posts: 306
Thanks: 24
Thanked 0 Times in 0 Posts
kamkam is an unknown quantity at this point
sorry,it give me the result still not right, but it is close.

锕=錒','','锿=鎄','','皑=皚','','嗳=噯','','蔼=藹','','霭=靄','','爱=愛','','嫒=嬡
kamkam is offline   Reply With Quote
Old 03-14-2009, 04:04 AM   PM User | #4
sea4me
Regular Coder

 
sea4me's Avatar
 
Join Date: Jan 2009
Location: Damn, I don't know...
Posts: 389
Thanks: 11
Thanked 27 Times in 26 Posts
sea4me is an unknown quantity at this point
lol I forgot that you had 2 spaces

PHP Code:
<?php  
 $search
="  ";  
 
$replace="','";  
 
$string="锕=錒  锿=鎄  皑=皚  嗳=噯  蔼=藹  霭=靄  爱=愛  嫒=嬡";  
 echo 
str_ireplace($search,$replace,$string);  
?>
__________________
sea4me is offline   Reply With Quote
Old 03-14-2009, 04:12 AM   PM User | #5
kamkam
Regular Coder

 
Join Date: Dec 2006
Posts: 306
Thanks: 24
Thanked 0 Times in 0 Posts
kamkam is an unknown quantity at this point
Thanks, in fact i have set two spaces for that from your code already, but it give me nothing when print out the result, but this time i copy and paste your code, and it works.

Thanks your time again.
kamkam is offline   Reply With Quote
Old 03-14-2009, 06:42 AM   PM User | #6
sea4me
Regular Coder

 
sea4me's Avatar
 
Join Date: Jan 2009
Location: Damn, I don't know...
Posts: 389
Thanks: 11
Thanked 27 Times in 26 Posts
sea4me is an unknown quantity at this point
Ur welcome!
__________________
sea4me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:30 PM.


Advertisement
Log in to turn off these ads.